From 8287458383134f7d0e0d56b7ccc0a52b953259e8 Mon Sep 17 00:00:00 2001 From: RICHQAQ <2206144600@qq.com> Date: Sat, 11 May 2024 11:04:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=A0=87=E9=A2=98=E5=90=8D=E7=A7=B0=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=BA=E5=BC=82=E6=AD=A5=E5=87=BD=E6=95=B0,?= =?UTF-8?q?=E6=8F=90=E9=AB=98=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/modules/chat/chat.service.js | 53 ++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/dist/modules/chat/chat.service.js b/dist/modules/chat/chat.service.js index bd72ac2..b72b431 100644 --- a/dist/modules/chat/chat.service.js +++ b/dist/modules/chat/chat.service.js @@ -224,22 +224,45 @@ let ChatService = class ChatService { if (groupId) { groupInfo = await this.chatGroupService.getGroupInfoFromId(groupId); } - if ((groupInfo === null || groupInfo === void 0 ? void 0 : groupInfo.title) === '新对话') { - let chatTitle; - if (modelType === 1) { - chatTitle = await this.apiDataService.chatFree(`根据用户提问{${prompt}},给这个对话取一个名字,不超过10个字`); + // if ((groupInfo === null || groupInfo === void 0 ? void 0 : groupInfo.title) === '新对话') { + // let chatTitle; + // if (modelType === 1) { + // chatTitle = await this.apiDataService.chatFree(`根据用户提问{${prompt}},给这个对话取一个名字,不超过10个字`); + // } + // else { + // chatTitle = '创意 AI'; + // } + // await this.chatGroupService.update({ + // groupId, + // title: chatTitle, + // isSticky: false, + // config: '', + // }, req); + // common_1.Logger.log(`更新标题名称为: ${chatTitle}`); + // } + + //将更新标题名称的代码改为异步函数 + const updateTitleAsync = async () => { + if ((groupInfo === null || groupInfo === void 0 ? void 0 : groupInfo.title) === '新对话') { + let chatTitle; + if (modelType === 1) { + chatTitle = await this.apiDataService.chatFree(`根据用户提问{${prompt}},给这个对话取一个名字,不超过10个字`); + } + else { + chatTitle = '创意 AI'; + } + await this.chatGroupService.update({ + groupId, + title: chatTitle, + isSticky: false, + config: '', + }, req); + common_1.Logger.log(`更新标题名称为: ${chatTitle}`); } - else { - chatTitle = '创意 AI'; - } - await this.chatGroupService.update({ - groupId, - title: chatTitle, - isSticky: false, - config: '', - }, req); - common_1.Logger.log(`更新标题名称为: ${chatTitle}`); - } + }; + + // 调用异步函数 + updateTitleAsync(); if (groupId) { await this.chatGroupService.updateTime(groupId); } From fce73205a26042251474868ef637009beafb423d Mon Sep 17 00:00:00 2001 From: RICHQAQ <2206144600@qq.com> Date: Sat, 11 May 2024 11:23:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=BC=82=E6=AD=A5=E6=9B=B4=E6=96=B0=E6=A0=87?= =?UTF-8?q?=E9=A2=98,=20=E6=8F=90=E9=AB=98=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/modules/chat/chat.service.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/modules/chat/chat.service.js b/dist/modules/chat/chat.service.js index b72b431..82e63e6 100644 --- a/dist/modules/chat/chat.service.js +++ b/dist/modules/chat/chat.service.js @@ -240,7 +240,7 @@ let ChatService = class ChatService { // }, req); // common_1.Logger.log(`更新标题名称为: ${chatTitle}`); // } - + //将更新标题名称的代码改为异步函数 const updateTitleAsync = async () => { if ((groupInfo === null || groupInfo === void 0 ? void 0 : groupInfo.title) === '新对话') { @@ -257,7 +257,7 @@ let ChatService = class ChatService { isSticky: false, config: '', }, req); - common_1.Logger.log(`更新标题名称为: ${chatTitle}`); + common_1.Logger.log(`${groupId} 更新标题名称为: ${chatTitle}`); } };