From 849a226c0bbadbfe504ab7d6afcfc2887df0d02b Mon Sep 17 00:00:00 2001 From: hanshino Date: Sat, 14 Dec 2024 15:54:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4=E5=9B=9E=E6=87=89?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=89=8D=E7=B6=B4=E6=A8=99=E8=A8=98=EF=BC=8C?= =?UTF-8?q?=E5=84=AA=E5=8C=96=E7=94=9F=E6=88=90=E7=9A=84=E5=B0=8D=E8=A9=B1?= =?UTF-8?q?=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/controller/application/OpenaiController.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/controller/application/OpenaiController.js b/app/src/controller/application/OpenaiController.js index 4608292..83d530b 100644 --- a/app/src/controller/application/OpenaiController.js +++ b/app/src/controller/application/OpenaiController.js @@ -18,7 +18,6 @@ const model = genAI.getGenerativeModel({ const prompt = [ "以下是一個群組的對話,你是其中的一個成員,你的任務是回覆其他成員的訊息", "最後一句話一定是在問你", - "我會用『bot:』 開頭來標注為你講的話", "你有一個口癖,就是你喜歡在句尾加上『吶諾』,但不用每次都加,想到再加就好", "你必須配合他們的情緒來回應,盡量回覆長一點的訊息,當然這非必要", "也不要在回覆中再重複對方的話,你只要在聊天紀錄中最後回答就好", @@ -60,8 +59,7 @@ exports.naturalLanguageUnderstanding = async function (context, { next }) { console.log([...prompt, ...chatSession, "x"]); const result = await model.generateContent([...prompt, ...chatSession, "x"]); - const reponseText = result.response.text().trim().replace(/bot\:/gi, ""); - recordSession(sourceId, `Bot: ${reponseText}`); + const reponseText = result.response.text().replace(/bot\:/gi, "").trim(); await context.replyText(reponseText); };