From 5023da4489379afc0b6bb2307954c3d15735b709 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Tue, 29 Apr 2025 12:05:04 +0800 Subject: [PATCH] Feat: Quote auth (#4715) * fix outlink quote number auth (#4705) * perf: quote auth * feat: qwen3 config --------- Co-authored-by: heheer --- .../zh-cn/docs/development/upgrading/498.md | 2 +- .../service/core/ai/config/provider/Qwen.json | 251 ++++++++++++++++-- packages/service/core/ai/config/utils.ts | 10 + packages/web/i18n/en/common.json | 2 +- projects/app/src/components/Markdown/A.tsx | 6 +- .../app/src/components/Markdown/index.tsx | 26 +- projects/app/src/components/Markdown/utils.ts | 3 +- .../chat/ChatContainer/ChatBox/Provider.tsx | 15 +- .../ChatBox/components/ChatItem.tsx | 1 + .../PluginRunBox/components/RenderOutput.tsx | 1 + .../core/chat/components/AIResponseBox.tsx | 29 +- .../account/model/AddModelBox.tsx | 14 +- .../src/pages/api/core/chat/quote/getQuote.ts | 4 +- .../api/core/dataset/data/getQuoteData.ts | 106 ++++++-- .../service/support/permission/auth/chat.ts | 2 +- projects/app/src/web/core/dataset/api.ts | 5 +- 16 files changed, 400 insertions(+), 77 deletions(-) diff --git a/docSite/content/zh-cn/docs/development/upgrading/498.md b/docSite/content/zh-cn/docs/development/upgrading/498.md index 613262428..fc758bdc5 100644 --- a/docSite/content/zh-cn/docs/development/upgrading/498.md +++ b/docSite/content/zh-cn/docs/development/upgrading/498.md @@ -10,7 +10,7 @@ weight: 792 ## 🚀 新增内容 -1. 支持 Streamable http mcp 模式,无需额外安装 mcp_server 即可以 MCP 方式对外提供 fastgpt 调用。 +1. qwen3 模型预设 ## ⚙️ 优化 diff --git a/packages/service/core/ai/config/provider/Qwen.json b/packages/service/core/ai/config/provider/Qwen.json index f0c1dd527..f6dbb8e39 100644 --- a/packages/service/core/ai/config/provider/Qwen.json +++ b/packages/service/core/ai/config/provider/Qwen.json @@ -2,14 +2,14 @@ "provider": "Qwen", "list": [ { - "model": "qwen-turbo", - "name": "Qwen-turbo", - "maxContext": 128000, - "maxResponse": 8000, - "quoteMaxToken": 100000, - "maxTemperature": 1, - "vision": false, - "toolChoice": true, + "model": "qwen-vl-plus", + "name": "qwen-vl-plus", + "maxContext": 32000, + "maxResponse": 2000, + "quoteMaxToken": 20000, + "maxTemperature": 1.2, + "vision": true, + "toolChoice": false, "functionCall": false, "defaultSystemChatPrompt": "", "datasetProcess": true, @@ -19,12 +19,9 @@ "usedInQueryExtension": true, "customExtractPrompt": "", "usedInToolCall": true, - "defaultConfig": {}, - "fieldMap": {}, "type": "llm", "showTopP": true, - "showStopSign": true, - "responseFormatList": ["text", "json_object"] + "showStopSign": true }, { "model": "qwen-plus", @@ -52,14 +49,14 @@ "responseFormatList": ["text", "json_object"] }, { - "model": "qwen-vl-plus", - "name": "qwen-vl-plus", - "maxContext": 32000, - "maxResponse": 2000, - "quoteMaxToken": 20000, - "maxTemperature": 1.2, - "vision": true, - "toolChoice": false, + "model": "qwen-turbo", + "name": "Qwen-turbo", + "maxContext": 128000, + "maxResponse": 8000, + "quoteMaxToken": 100000, + "maxTemperature": 1, + "vision": false, + "toolChoice": true, "functionCall": false, "defaultSystemChatPrompt": "", "datasetProcess": true, @@ -69,10 +66,14 @@ "usedInQueryExtension": true, "customExtractPrompt": "", "usedInToolCall": true, + "defaultConfig": {}, + "fieldMap": {}, "type": "llm", "showTopP": true, - "showStopSign": true + "showStopSign": true, + "responseFormatList": ["text", "json_object"] }, + { "model": "qwen-max", "name": "Qwen-max", @@ -122,6 +123,214 @@ "showTopP": true, "showStopSign": true }, + { + "model": "qwen3-235b-a22b", + "name": "qwen3-235b-a22b", + "maxContext": 128000, + "maxResponse": 8000, + "quoteMaxToken": 100000, + "maxTemperature": 1, + "vision": false, + "reasoning": true, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + "defaultConfig": {}, + "fieldMap": {}, + "type": "llm", + "showTopP": true, + "showStopSign": true, + "responseFormatList": ["text", "json_object"] + }, + { + "model": "qwen3-32b", + "name": "qwen3-32b", + "maxContext": 128000, + "maxResponse": 8000, + "quoteMaxToken": 100000, + "maxTemperature": 1, + "vision": false, + "reasoning": true, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + "defaultConfig": {}, + "fieldMap": {}, + "type": "llm", + "showTopP": true, + "showStopSign": true, + "responseFormatList": ["text", "json_object"] + }, + { + "model": "qwen3-30b-a3b", + "name": "qwen3-30b-a3b", + "maxContext": 128000, + "maxResponse": 8000, + "quoteMaxToken": 100000, + "maxTemperature": 1, + "vision": false, + "reasoning": true, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + "defaultConfig": {}, + "fieldMap": {}, + "type": "llm", + "showTopP": true, + "showStopSign": true, + "responseFormatList": ["text", "json_object"] + }, + { + "model": "qwen3-14b", + "name": "qwen3-14b", + "maxContext": 128000, + "maxResponse": 8000, + "quoteMaxToken": 100000, + "maxTemperature": 1, + "vision": false, + "reasoning": true, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + "defaultConfig": {}, + "fieldMap": {}, + "type": "llm", + "showTopP": true, + "showStopSign": true, + "responseFormatList": ["text", "json_object"] + }, + { + "model": "qwen3-8b", + "name": "qwen3-8b", + "maxContext": 128000, + "maxResponse": 8000, + "quoteMaxToken": 100000, + "maxTemperature": 1, + "vision": false, + "reasoning": true, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + "defaultConfig": {}, + "fieldMap": {}, + "type": "llm", + "showTopP": true, + "showStopSign": true, + "responseFormatList": ["text", "json_object"] + }, + { + "model": "qwen3-4b", + "name": "qwen3-4b", + "maxContext": 128000, + "maxResponse": 8000, + "quoteMaxToken": 100000, + "maxTemperature": 1, + "vision": false, + "reasoning": true, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + "defaultConfig": {}, + "fieldMap": {}, + "type": "llm", + "showTopP": true, + "showStopSign": true, + "responseFormatList": ["text", "json_object"] + }, + { + "model": "qwen3-1.7b", + "name": "qwen3-1.7b", + "maxContext": 32000, + "maxResponse": 8000, + "quoteMaxToken": 30000, + "maxTemperature": 1, + "vision": false, + "reasoning": true, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + "defaultConfig": {}, + "fieldMap": {}, + "type": "llm", + "showTopP": true, + "showStopSign": true, + "responseFormatList": ["text", "json_object"] + }, + { + "model": "qwen3-0.6b", + "name": "qwen3-0.6b", + "maxContext": 32000, + "maxResponse": 8000, + "quoteMaxToken": 30000, + "maxTemperature": 1, + "vision": false, + "reasoning": true, + "toolChoice": true, + "functionCall": false, + "defaultSystemChatPrompt": "", + "datasetProcess": true, + "usedInClassify": true, + "customCQPrompt": "", + "usedInExtractFields": true, + "usedInQueryExtension": true, + "customExtractPrompt": "", + "usedInToolCall": true, + "defaultConfig": {}, + "fieldMap": {}, + "type": "llm", + "showTopP": true, + "showStopSign": true, + "responseFormatList": ["text", "json_object"] + }, { "model": "qwq-plus", "name": "qwq-plus", diff --git a/packages/service/core/ai/config/utils.ts b/packages/service/core/ai/config/utils.ts index 35b1209fb..848b2b154 100644 --- a/packages/service/core/ai/config/utils.ts +++ b/packages/service/core/ai/config/utils.ts @@ -110,6 +110,12 @@ export const loadSystemModels = async (init = false) => { provider: ModelProviderIdType; list: SystemModelItemType[]; }; + const mergeObject = (obj1: any, obj2: any) => { + if (!obj1 && !obj2) return undefined; + const formatObj1 = typeof obj1 === 'object' ? obj1 : {}; + const formatObj2 = typeof obj2 === 'object' ? obj2 : {}; + return { ...formatObj1, ...formatObj2 }; + }; fileContent.list.forEach((fileModel) => { const dbModel = dbModels.find((item) => item.model === fileModel.model); @@ -117,6 +123,10 @@ export const loadSystemModels = async (init = false) => { const modelData: any = { ...fileModel, ...dbModel?.metadata, + // @ts-ignore + defaultConfig: mergeObject(fileModel.defaultConfig, dbModel?.metadata?.defaultConfig), + // @ts-ignore + fieldMap: mergeObject(fileModel.fieldMap, dbModel?.metadata?.fieldMap), provider: getModelProvider(dbModel?.metadata?.provider || fileContent.provider).id, type: dbModel?.metadata?.type || fileModel.type, isCustom: false diff --git a/packages/web/i18n/en/common.json b/packages/web/i18n/en/common.json index df5cd4a4d..c53a73a9d 100644 --- a/packages/web/i18n/en/common.json +++ b/packages/web/i18n/en/common.json @@ -36,7 +36,7 @@ "Warning": "Warning", "add_new": "Add New", "add_new_param": "Add new param", - "all_quotes": "Quote all", + "all_quotes": "All quotes", "app.templateMarket.templateTags.Image_generation": "Image generation", "app.templateMarket.templateTags.Office_services": "Office Services", "app.templateMarket.templateTags.Roleplay": "role play", diff --git a/projects/app/src/components/Markdown/A.tsx b/projects/app/src/components/Markdown/A.tsx index 652261e08..9336467a3 100644 --- a/projects/app/src/components/Markdown/A.tsx +++ b/projects/app/src/components/Markdown/A.tsx @@ -22,7 +22,7 @@ import { getCollectionSourceData } from '@fastgpt/global/core/dataset/collection import Markdown from '.'; import { getSourceNameIcon } from '@fastgpt/global/core/dataset/utils'; -const A = ({ children, ...props }: any) => { +const A = ({ children, chatAuthData, ...props }: any) => { const { t } = useTranslation(); const { isOpen, onOpen, onClose } = useDisclosure(); @@ -52,7 +52,7 @@ const A = ({ children, ...props }: any) => { data: quoteData, loading, runAsync: getQuoteDataById - } = useRequest2(getQuoteData, { + } = useRequest2((id: string) => getQuoteData({ id, ...chatAuthData }), { manual: true }); const sourceData = useMemo( @@ -149,4 +149,4 @@ const A = ({ children, ...props }: any) => { return {children}; }; -export default A; +export default React.memo(A); diff --git a/projects/app/src/components/Markdown/index.tsx b/projects/app/src/components/Markdown/index.tsx index dea85eb8d..a7d71d5ae 100644 --- a/projects/app/src/components/Markdown/index.tsx +++ b/projects/app/src/components/Markdown/index.tsx @@ -12,6 +12,8 @@ import dynamic from 'next/dynamic'; import { Box } from '@chakra-ui/react'; import { CodeClassNameEnum, mdTextFormat } from './utils'; +import { useCreation } from 'ahooks'; +import { OutLinkChatAuthProps } from '@fastgpt/global/support/permission/chat'; const CodeLight = dynamic(() => import('./codeBlock/CodeLight'), { ssr: false }); const MermaidCodeBlock = dynamic(() => import('./img/MermaidCodeBlock'), { ssr: false }); @@ -31,6 +33,11 @@ type Props = { showAnimation?: boolean; isDisabled?: boolean; forbidZhFormat?: boolean; + chatAuthData?: { + appId: string; + chatId: string; + chatItemDataId: string; + } & OutLinkChatAuthProps; }; const Markdown = (props: Props) => { const source = props.source || ''; @@ -41,16 +48,21 @@ const Markdown = (props: Props) => { return {source}; }; -const MarkdownRender = ({ source = '', showAnimation, isDisabled, forbidZhFormat }: Props) => { - const components = useMemo( - () => ({ +const MarkdownRender = ({ + source = '', + showAnimation, + isDisabled, + forbidZhFormat, + chatAuthData +}: Props) => { + const components = useCreation(() => { + return { img: Image, pre: RewritePre, code: Code, - a: A - }), - [] - ); + a: (props: any) => + }; + }, [chatAuthData]); const formatSource = useMemo(() => { if (showAnimation || forbidZhFormat) return source; diff --git a/projects/app/src/components/Markdown/utils.ts b/projects/app/src/components/Markdown/utils.ts index feb21c149..bc0122303 100644 --- a/projects/app/src/components/Markdown/utils.ts +++ b/projects/app/src/components/Markdown/utils.ts @@ -33,8 +33,7 @@ export const mdTextFormat = (text: string) => { // /([\u4e00-\u9fa5\u3000-\u303f])([a-zA-Z0-9])|([a-zA-Z0-9])([\u4e00-\u9fa5\u3000-\u303f])/g, // '$1$3 $2$4' // ) - // 处理 [quote:id] 格式引用,将 [quote:675934a198f46329dfc6d05a] 转换为 [675934a198f46329dfc6d05a](QUOTE) - .replace(/\[quote:?\s*([a-f0-9]{24})\](?!\()/gi, '[$1](QUOTE)') + // 处理 格式引用,将 [675934a198f46329dfc6d05a] 转换为 [675934a198f46329dfc6d05a](QUOTE) .replace(/\[([a-f0-9]{24})\](?!\()/g, '[$1](QUOTE)'); // 处理链接后的中文标点符号,增加空格 diff --git a/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx b/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx index 3b1ff2f14..d56ae9521 100644 --- a/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx +++ b/projects/app/src/components/core/chat/ChatContainer/ChatBox/Provider.tsx @@ -22,6 +22,7 @@ import { VariableInputEnum } from '@fastgpt/global/core/workflow/constants'; import { getChatResData } from '@/web/core/chat/api'; import { ChatItemContext } from '@/web/core/chat/context/chatItemContext'; import { ChatRecordContext } from '@/web/core/chat/context/chatRecordContext'; +import { useCreation } from 'ahooks'; export type ChatProviderProps = { appId: string; @@ -128,13 +129,17 @@ export const ChatBoxContext = createContext({ const Provider = ({ appId, chatId, - outLinkAuthData = {}, + outLinkAuthData, chatType = 'chat', children, ...props }: ChatProviderProps & { children: React.ReactNode; }) => { + const formatOutLinkAuth = useCreation(() => { + return outLinkAuthData || {}; + }, [outLinkAuthData]); + const welcomeText = useContextSelector( ChatItemContext, (v) => v.chatBoxData?.app?.chatConfig?.welcomeText ?? '' @@ -187,7 +192,7 @@ const Provider = ({ } = useAudioPlay({ appId, ttsConfig, - ...outLinkAuthData + ...formatOutLinkAuth }); const autoTTSResponse = @@ -209,7 +214,7 @@ const Provider = ({ appId: appId, chatId: chatId, dataId, - ...outLinkAuthData + ...formatOutLinkAuth }); setChatRecords((state) => state.map((item) => (item.dataId === dataId ? { ...item, responseData: resData } : item)) @@ -217,7 +222,7 @@ const Provider = ({ return resData; } }, - [chatRecords, chatId, appId, outLinkAuthData, setChatRecords] + [chatRecords, chatId, appId, formatOutLinkAuth, setChatRecords] ); const value: useChatStoreType = { ...props, @@ -243,7 +248,7 @@ const Provider = ({ chatInputGuide, appId, chatId, - outLinkAuthData, + outLinkAuthData: formatOutLinkAuth, getHistoryResponseData, chatType }; diff --git a/projects/app/src/components/core/chat/ChatContainer/ChatBox/components/ChatItem.tsx b/projects/app/src/components/core/chat/ChatContainer/ChatBox/components/ChatItem.tsx index e35cec84e..d9d9a790b 100644 --- a/projects/app/src/components/core/chat/ChatContainer/ChatBox/components/ChatItem.tsx +++ b/projects/app/src/components/core/chat/ChatContainer/ChatBox/components/ChatItem.tsx @@ -100,6 +100,7 @@ const AIContentCard = React.memo(function AIContentCard({ return ( { const key = `${histories[1].dataId}-ai-${i}`; return ( v.isResponseDetail); + const appId = useContextSelector(ChatBoxContext, (v) => v.appId); + const chatId = useContextSelector(ChatBoxContext, (v) => v.chatId); + const outLinkAuthData = useContextSelector(ChatBoxContext, (v) => v.outLinkAuthData); + const source = useMemo(() => { if (!text) return ''; // Remove quote references if not showing response detail - return isResponseDetail ? text : text.replace(/\[[a-f0-9]{24}\]\(QUOTE\)/g, ''); + return isResponseDetail + ? text + : text.replace(/\[([a-f0-9]{24})\]\(QUOTE\)/g, '').replace(/\[([a-f0-9]{24})\](?!\()/g, ''); }, [text, isResponseDetail]); - // First empty line - // if (!source && !isLastChild) return null; + const chatAuthData = useCreation(() => { + return { appId, chatId, chatItemDataId, ...outLinkAuthData }; + }, [appId, chatId, chatItemDataId, outLinkAuthData]); - return ; + return ; }); const RenderTool = React.memo( @@ -230,17 +241,23 @@ const RenderUserFormInteractive = React.memo(function RenderFormInput({ }); const AIResponseBox = ({ + chatItemDataId, value, isLastResponseValue, isChatting }: { + chatItemDataId: string; value: UserChatItemValueItemType | AIChatItemValueItemType; isLastResponseValue: boolean; isChatting: boolean; }) => { if (value.type === ChatItemValueTypeEnum.text && value.text) { return ( - + ); } if (value.type === ChatItemValueTypeEnum.reasoning && value.reasoning) { diff --git a/projects/app/src/pageComponents/account/model/AddModelBox.tsx b/projects/app/src/pageComponents/account/model/AddModelBox.tsx index d0ada4527..6b712d3b6 100644 --- a/projects/app/src/pageComponents/account/model/AddModelBox.tsx +++ b/projects/app/src/pageComponents/account/model/AddModelBox.tsx @@ -143,6 +143,7 @@ export const ModelEditModal = ({ data[key] = ''; } } + return putSystemModel({ model: data.model, metadata: data @@ -490,7 +491,7 @@ export const ModelEditModal = ({ value={JSON.stringify(getValues('defaultConfig'), null, 2)} onChange={(e) => { if (!e) { - setValue('defaultConfig', {}); + setValue('defaultConfig', undefined); return; } try { @@ -582,12 +583,6 @@ export const ModelEditModal = ({ - - - {t('account:model.function_call')} - - - @@ -720,12 +715,13 @@ export const ModelEditModal = ({ value={JSON.stringify(getValues('defaultConfig'), null, 2)} resize onChange={(e) => { + console.log(e, '==='); if (!e) { - setValue('defaultConfig', {}); + setValue('defaultConfig', undefined); return; } try { - setValue('defaultConfig', JSON.parse(e)); + setValue('defaultConfig', JSON.parse(e.trim())); } catch (error) { console.error(error); } diff --git a/projects/app/src/pages/api/core/chat/quote/getQuote.ts b/projects/app/src/pages/api/core/chat/quote/getQuote.ts index e2dcf7a29..654592272 100644 --- a/projects/app/src/pages/api/core/chat/quote/getQuote.ts +++ b/projects/app/src/pages/api/core/chat/quote/getQuote.ts @@ -36,7 +36,7 @@ async function handler(req: ApiRequestProps): Promise): Promise { - const { id: dataId } = req.query as { - id: string; - }; +export type GetQuoteDataProps = + | { + id: string; + } + | ({ + id: string; + appId: string; + chatId: string; + chatItemDataId: string; + } & OutLinkChatAuthProps); - // 凭证校验 - const { datasetData, collection } = await authDatasetData({ - req, - authToken: true, - authApiKey: true, - dataId, - per: ReadPermissionVal - }); +async function handler(req: ApiRequestProps): Promise { + const { id: dataId } = req.body; + + // Auth + const { collection, q, a } = await (async () => { + if ('chatId' in req.body) { + const { appId, chatId, shareId, outLinkUid, teamId, teamToken, chatItemDataId } = req.body; + await authChatCrud({ + req, + authToken: true, + appId, + chatId, + shareId, + outLinkUid, + teamId, + teamToken + }); + + const datasetData = await MongoDatasetData.findById(dataId); + if (!datasetData) { + return Promise.reject('Can not find the data'); + } + + const [collection, { responseDetail }] = await Promise.all([ + MongoDatasetCollection.findById(datasetData.collectionId).lean(), + authChatCrud({ + req, + authToken: true, + appId, + chatId, + shareId, + outLinkUid, + teamId, + teamToken + }), + authCollectionInChat({ + appId, + chatId, + chatItemDataId, + collectionIds: [String(datasetData.collectionId)] + }) + ]); + if (!collection) { + return Promise.reject('Can not find the collection'); + } + if (!responseDetail) { + return Promise.reject(ChatErrEnum.unAuthChat); + } + + return { + collection, + q: datasetData.q, + a: datasetData.a + }; + } else { + const { datasetData, collection } = await authDatasetData({ + req, + authToken: true, + authApiKey: true, + dataId, + per: ReadPermissionVal + }); + return { + collection, + q: datasetData.q, + a: datasetData.a + }; + } + })(); return { collection, - q: datasetData.q, - a: datasetData.a + q, + a }; } diff --git a/projects/app/src/service/support/permission/auth/chat.ts b/projects/app/src/service/support/permission/auth/chat.ts index 5308e5cfc..e42b862e2 100644 --- a/projects/app/src/service/support/permission/auth/chat.ts +++ b/projects/app/src/service/support/permission/auth/chat.ts @@ -236,7 +236,7 @@ export const authCollectionInChat = async ({ .flat() ); - if (collectionIds.every((id) => quoteListSet.has(id))) { + if (collectionIds.every((id) => quoteListSet.has(String(id)))) { return { chatItem }; diff --git a/projects/app/src/web/core/dataset/api.ts b/projects/app/src/web/core/dataset/api.ts index ce2b9e9f9..77a6633aa 100644 --- a/projects/app/src/web/core/dataset/api.ts +++ b/projects/app/src/web/core/dataset/api.ts @@ -72,6 +72,7 @@ import type { getTrainingErrorResponse } from '@/pages/api/core/dataset/training/getTrainingError'; import type { APIFileItem } from '@fastgpt/global/core/dataset/apiDataset'; +import { GetQuoteDataProps } from '@/pages/api/core/chat/quote/getQuote'; /* ======================== dataset ======================= */ export const getDatasets = (data: GetDatasetListBody) => @@ -216,8 +217,8 @@ export const delOneDatasetDataById = (id: string) => DELETE(`/core/dataset/data/delete`, { id }); // Get quote data -export const getQuoteData = (id: string) => - GET(`/core/dataset/data/getQuoteData`, { id }); +export const getQuoteData = (data: GetQuoteDataProps) => + POST(`/core/dataset/data/getQuoteData`, data); /* ================ training ==================== */ export const postRebuildEmbedding = (data: rebuildEmbeddingBody) =>