fix: 修复更新标题失败导致后台崩溃的问题

This commit is contained in:
vastxie 2024-07-12 11:56:23 +08:00 committed by GitHub
parent 5ffcf6beed
commit 661a6a95f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -659,6 +659,9 @@ let ChatService = class ChatService {
if (modelType === 1) {
try {
chatTitle = await this.openAIChatService.chatFree(`根据用户提问{${prompt}}给这个对话取一个名字不超过10个字`);
if (chatTitle.length > 15) {
chatTitle = chatTitle.slice(0, 15);
}
}
catch (error) {
common_1.Logger.error(`调用 chatFree 出错: ${error}`);
@ -668,9 +671,6 @@ let ChatService = class ChatService {
else {
chatTitle = '创意 AI';
}
if (chatTitle.length > 15) {
chatTitle = chatTitle.slice(0, 15);
}
this.chatGroupService
.update({
groupId,