fix source name (#3834)

This commit is contained in:
heheer
2025-02-19 20:42:30 +08:00
committed by GitHub
parent 206325bc5f
commit 8604cbd021
5 changed files with 10 additions and 2 deletions

View File

@@ -54,6 +54,9 @@ const ChatSchema = new Schema({
type: String,
required: true
},
sourceName: {
type: String
},
shareId: {
type: String
},

View File

@@ -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,

View File

@@ -204,7 +204,7 @@ const Logs = () => {
>
<Td>
{/* @ts-ignore */}
<Box>{t(ChatSourceMap[item.source]?.name) || item.source}</Box>
<Box>{item.sourceName || t(ChatSourceMap[item.source]?.name) || item.source}</Box>
<Box color={'myGray.500'}>{dayjs(item.time).format('YYYY/MM/DD HH:mm')}</Box>
</Td>
<Td>

View File

@@ -139,6 +139,7 @@ async function handler(
title: 1,
customTitle: 1,
source: 1,
sourceName: 1,
time: '$updateTime',
messageCount: { $size: '$chatitems' },
userGoodFeedbackCount: 1,

View File

@@ -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,