From efc9f40f77274a40cd3131c81f5676146710a8e8 Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Thu, 4 Jul 2024 15:43:39 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E8=A9=B1=E9=A0=BB=E5=BA=A6=E3=82=921/?= =?UTF-8?q?10=E3=81=AB=E8=90=BD=E3=81=A8=E3=81=99=E3=83=BB=E6=9C=80?= =?UTF-8?q?=E6=96=B010=E4=BB=B6=E4=BB=A5=E4=B8=8A=E3=81=AF=E8=A6=9A?= =?UTF-8?q?=E3=81=88=E3=81=AA=E3=81=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/main.ts b/main.ts index 74fc224..8ad92eb 100644 --- a/main.ts +++ b/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; -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");