Commit 8604cbd0 by heheer Committed by GitHub

fix source name (#3834)

parent 206325bc
...@@ -54,6 +54,9 @@ const ChatSchema = new Schema({ ...@@ -54,6 +54,9 @@ const ChatSchema = new Schema({
type: String, type: String,
required: true required: true
}, },
sourceName: {
type: String
},
shareId: { shareId: {
type: String type: String
}, },
......
...@@ -23,6 +23,7 @@ type Props = { ...@@ -23,6 +23,7 @@ type Props = {
isUpdateUseTime: boolean; isUpdateUseTime: boolean;
newTitle: string; newTitle: string;
source: string; source: string;
sourceName: string;
shareId?: string; shareId?: string;
outLinkUid?: string; outLinkUid?: string;
content: [UserChatItemType & { dataId?: string }, AIChatItemType & { dataId?: string }]; content: [UserChatItemType & { dataId?: string }, AIChatItemType & { dataId?: string }];
...@@ -40,6 +41,7 @@ export async function saveChat({ ...@@ -40,6 +41,7 @@ export async function saveChat({
isUpdateUseTime, isUpdateUseTime,
newTitle, newTitle,
source, source,
sourceName,
shareId, shareId,
outLinkUid, outLinkUid,
content, content,
...@@ -96,6 +98,7 @@ export async function saveChat({ ...@@ -96,6 +98,7 @@ export async function saveChat({
pluginInputs, pluginInputs,
title: newTitle, title: newTitle,
source, source,
sourceName,
shareId, shareId,
outLinkUid, outLinkUid,
metadata: metadataUpdate, metadata: metadataUpdate,
......
...@@ -204,7 +204,7 @@ const Logs = () => { ...@@ -204,7 +204,7 @@ const Logs = () => {
> >
<Td> <Td>
{/* @ts-ignore */} {/* @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> <Box color={'myGray.500'}>{dayjs(item.time).format('YYYY/MM/DD HH:mm')}</Box>
</Td> </Td>
<Td> <Td>
......
...@@ -139,6 +139,7 @@ async function handler( ...@@ -139,6 +139,7 @@ async function handler(
title: 1, title: 1,
customTitle: 1, customTitle: 1,
source: 1, source: 1,
sourceName: 1,
time: '$updateTime', time: '$updateTime',
messageCount: { $size: '$chatitems' }, messageCount: { $size: '$chatitems' },
userGoodFeedbackCount: 1, userGoodFeedbackCount: 1,
......
...@@ -352,7 +352,8 @@ async function handler(req: NextApiRequest, res: NextApiResponse) { ...@@ -352,7 +352,8 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
newTitle, newTitle,
shareId, shareId,
outLinkUid: outLinkUserId, outLinkUid: outLinkUserId,
source: sourceName || source, source: source,
sourceName: sourceName || '',
content: [userQuestion, aiResponse], content: [userQuestion, aiResponse],
metadata: { metadata: {
originIp, originIp,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment