diff --git a/packages/service/core/chat/chatSchema.ts b/packages/service/core/chat/chatSchema.ts index b4a0afe62..b370c1e43 100644 --- a/packages/service/core/chat/chatSchema.ts +++ b/packages/service/core/chat/chatSchema.ts @@ -54,6 +54,9 @@ const ChatSchema = new Schema({ type: String, required: true }, + sourceName: { + type: String + }, shareId: { type: String }, diff --git a/packages/service/core/chat/saveChat.ts b/packages/service/core/chat/saveChat.ts index c5f7b0708..efb5c0605 100644 --- a/packages/service/core/chat/saveChat.ts +++ b/packages/service/core/chat/saveChat.ts @@ -23,6 +23,7 @@ type Props = { isUpdateUseTime: boolean; newTitle: string; source: string; + sourceName: string; shareId?: string; outLinkUid?: string; content: [UserChatItemType & { dataId?: string }, AIChatItemType & { dataId?: string }]; @@ -40,6 +41,7 @@ export async function saveChat({ isUpdateUseTime, newTitle, source, + sourceName, shareId, outLinkUid, content, @@ -96,6 +98,7 @@ export async function saveChat({ pluginInputs, title: newTitle, source, + sourceName, shareId, outLinkUid, metadata: metadataUpdate, diff --git a/projects/app/src/pageComponents/app/detail/Logs/index.tsx b/projects/app/src/pageComponents/app/detail/Logs/index.tsx index f62fa7b28..34a86e558 100644 --- a/projects/app/src/pageComponents/app/detail/Logs/index.tsx +++ b/projects/app/src/pageComponents/app/detail/Logs/index.tsx @@ -204,7 +204,7 @@ const Logs = () => { > {/* @ts-ignore */} - {t(ChatSourceMap[item.source]?.name) || item.source} + {item.sourceName || t(ChatSourceMap[item.source]?.name) || item.source} {dayjs(item.time).format('YYYY/MM/DD HH:mm')} diff --git a/projects/app/src/pages/api/core/app/getChatLogs.ts b/projects/app/src/pages/api/core/app/getChatLogs.ts index ca9965f71..00c44237a 100644 --- a/projects/app/src/pages/api/core/app/getChatLogs.ts +++ b/projects/app/src/pages/api/core/app/getChatLogs.ts @@ -139,6 +139,7 @@ async function handler( title: 1, customTitle: 1, source: 1, + sourceName: 1, time: '$updateTime', messageCount: { $size: '$chatitems' }, userGoodFeedbackCount: 1, diff --git a/projects/app/src/pages/api/v1/chat/completions.ts b/projects/app/src/pages/api/v1/chat/completions.ts index 0ed305014..6e3b143d4 100644 --- a/projects/app/src/pages/api/v1/chat/completions.ts +++ b/projects/app/src/pages/api/v1/chat/completions.ts @@ -352,7 +352,8 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { newTitle, shareId, outLinkUid: outLinkUserId, - source: sourceName || source, + source: source, + sourceName: sourceName || '', content: [userQuestion, aiResponse], metadata: { originIp,