mirror of
https://github.com/kou029w/daraz-llm.git
synced 2025-01-18 08:05:12 +00:00
会話頻度を1/10に落とす・最新10件以上は覚えない
This commit is contained in:
parent
5ae513c8c0
commit
efc9f40f77
1 changed files with 5 additions and 3 deletions
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