mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-01 11:58:38 +00:00
Optimize the file storage structure of the knowledge base (#386)
This commit is contained in:
@@ -36,7 +36,8 @@ const ResponseTags = ({ responseData = [] }: { responseData?: ChatHistoryItemRes
|
||||
quoteList: responseData
|
||||
.filter((item) => item.moduleType === FlowModuleTypeEnum.chatNode)
|
||||
.map((item) => item.quoteList)
|
||||
.flat(),
|
||||
.flat()
|
||||
.filter((item) => item) as QuoteItemType[],
|
||||
historyPreview: chatData?.historyPreview,
|
||||
runningTime: +responseData.reduce((sum, item) => sum + (item.runningTime || 0), 0).toFixed(2)
|
||||
};
|
||||
|
@@ -63,6 +63,7 @@ import styles from './index.module.scss';
|
||||
import Script from 'next/script';
|
||||
import { postQuestionGuide } from '@/api/core/ai/agent/api';
|
||||
import { splitGuideModule } from './utils';
|
||||
import { DatasetSpecialIdEnum } from '@fastgpt/core/dataset/constant';
|
||||
|
||||
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 24);
|
||||
|
||||
@@ -511,6 +512,12 @@ const ChatBox = (
|
||||
|
||||
// add guide text listener
|
||||
useEffect(() => {
|
||||
const windowMessage = ({ data }: MessageEvent<{ type: 'sendPrompt'; text: string }>) => {
|
||||
if (data?.type === 'sendPrompt' && data?.text) {
|
||||
handleSubmit((item) => sendPrompt(item, data.text))();
|
||||
}
|
||||
};
|
||||
window.addEventListener('message', windowMessage);
|
||||
event.on('guideClick', ({ text }: { text: string }) => {
|
||||
if (!text) return;
|
||||
handleSubmit((data) => sendPrompt(data, text))();
|
||||
@@ -518,6 +525,7 @@ const ChatBox = (
|
||||
|
||||
return () => {
|
||||
event.off('guideClick');
|
||||
window.removeEventListener('message', windowMessage);
|
||||
};
|
||||
}, [handleSubmit, sendPrompt]);
|
||||
|
||||
@@ -995,7 +1003,8 @@ const ChatBox = (
|
||||
defaultValues={{
|
||||
dataId: adminMarkData.dataId,
|
||||
q: adminMarkData.q,
|
||||
a: adminMarkData.a
|
||||
a: adminMarkData.a,
|
||||
file_id: DatasetSpecialIdEnum.mark
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
Reference in New Issue
Block a user