mirror of
https://github.com/kou029w/daraz-llm.git
synced 2025-02-01 14:48:42 +00:00
Compare commits
2 commits
90b8873e2f
...
efc9f40f77
Author | SHA1 | Date | |
---|---|---|---|
efc9f40f77 | |||
5ae513c8c0 |
2 changed files with 6 additions and 6 deletions
|
@ -5,9 +5,7 @@ LLM 版だらずさん
|
|||
## インストール
|
||||
|
||||
Step 1
|
||||
: Slack アプリの作成
|
||||
|
||||
[Create New Slack App](https://api.slack.com/apps?new_app=1&manifest_yaml={display_information:%20{name:%20darazllm},%20features:%20{bot_user:%20{display_name:%20darazllm}},%20oauth_config:%20{scopes:%20{bot:%20[%27channels:history%27,%20%27chat:write%27]}},%20settings:%20{event_subscriptions:%20{request_url:%20%27https://darazllm.deno.dev/slack/events%27,%20bot_events:%20[message.channels]}}}) > Select a workspace > Create > Install to Workspace
|
||||
: [Create New Slack App](https://api.slack.com/apps?new_app=1&manifest_yaml={display_information:%20{name:%20darazllm},%20features:%20{bot_user:%20{display_name:%20darazllm}},%20oauth_config:%20{scopes:%20{bot:%20[%27channels:history%27,%20%27chat:write%27]}},%20settings:%20{event_subscriptions:%20{request_url:%20%27https://darazllm.deno.dev/slack/events%27,%20bot_events:%20[message.channels]}}}) > Select a workspace > Create > Install to Workspace
|
||||
|
||||
Step 2
|
||||
: [Fork to Edit](https://dash.deno.com/playground/darazllm) > Settings > Environment Variables
|
||||
|
|
8
main.ts
8
main.ts
|
@ -14,7 +14,8 @@ const system = `\
|
|||
賢い猫。少しだらしない。趣味はさんぽとねんね。
|
||||
全て鳥取弁で語尾が「にゃん」。`;
|
||||
|
||||
const n = 3;
|
||||
const n = 10;
|
||||
const model = "llama3-70b-8192";
|
||||
const usage = `\
|
||||
https://dash.deno.com/playground/darazllm
|
||||
|
||||
|
@ -23,6 +24,8 @@ https://dash.deno.com/playground/darazllm
|
|||
@darazllm /bye すべて忘れる
|
||||
@darazllm /help このテキストを表示
|
||||
|
||||
使用する会話: 最新${n}件
|
||||
モデル: ${model}
|
||||
システムプロンプト:
|
||||
|
||||
${system}`;
|
||||
|
@ -32,7 +35,6 @@ import { Groq } from "npm:groq-sdk";
|
|||
|
||||
type Messages = Array<Groq.Chat.CompletionCreateParams.Message>;
|
||||
|
||||
const model = "llama3-70b-8192";
|
||||
const groq = new Groq({
|
||||
apiKey: GROQ_API_KEY,
|
||||
timeout: 10_000,
|
||||
|
@ -79,7 +81,7 @@ app.message(async (c) => {
|
|||
|
||||
if (isMention || Math.floor(Math.random() * n) === 0) {
|
||||
try {
|
||||
const res = await chat(messages);
|
||||
const res = await chat(messages.slice(-n));
|
||||
|
||||
if (!res) throw new Error("Empty response");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue