From 5c935450162f49adf0fc21e544614d93db0458dc Mon Sep 17 00:00:00 2001 From: heheer Date: Tue, 22 Apr 2025 20:10:35 +0800 Subject: [PATCH] fix 4.9.6 (#4631) * fix debug quote list * delete next text node match * fix extract default boolean value * export latest 100 chat items * fix quote item ui * doc * fix doc --- .../zh-cn/docs/development/upgrading/497.md | 4 +++ .../core/workflow/dispatch/agent/extract.ts | 2 +- .../common/Textarea/PromptEditor/utils.ts | 6 ----- packages/web/i18n/en/app.json | 2 +- packages/web/i18n/zh-CN/app.json | 2 +- packages/web/i18n/zh-Hant/app.json | 2 +- .../ChatBox/components/QuoteList.tsx | 27 ++++++++++--------- .../chat/ChatQuoteList/QuoteItem.tsx | 6 +++-- .../src/pages/api/core/app/exportChatLogs.ts | 3 +-- 9 files changed, 28 insertions(+), 26 deletions(-) diff --git a/docSite/content/zh-cn/docs/development/upgrading/497.md b/docSite/content/zh-cn/docs/development/upgrading/497.md index 8b63e89d4..e716214cc 100644 --- a/docSite/content/zh-cn/docs/development/upgrading/497.md +++ b/docSite/content/zh-cn/docs/development/upgrading/497.md @@ -21,4 +21,8 @@ weight: 793 2. 使用记录仪表盘,无法获取指定成员的使用统计。 3. 仪表盘接口,因未考虑时区问题,统计异常。 4. LLM 模型测试接口,无法测试未启用的 LLM。同时修复,模型测试接口会把模型自定义请求地址去除问题。 +5. 导出对话记录,限制单条对话记录消息上限 1000 组,避免导出失败。 +6. 工作流变量下一段文本仍是工作流变量,不触发渲染。 +7. 调试知识库检索模块,提示无权操作知识库。 +8. 文本内容提取节点,默认值赋值逻辑。 diff --git a/packages/service/core/workflow/dispatch/agent/extract.ts b/packages/service/core/workflow/dispatch/agent/extract.ts index 53008680d..e3886f7e2 100644 --- a/packages/service/core/workflow/dispatch/agent/extract.ts +++ b/packages/service/core/workflow/dispatch/agent/extract.ts @@ -103,7 +103,7 @@ export async function dispatchContentExtract(props: Props): Promise { // auto fill required fields extractKeys.forEach((item) => { - if (item.required && !arg[item.key]) { + if (item.required && arg[item.key] === undefined) { arg[item.key] = item.defaultValue || ''; } }); diff --git a/packages/web/components/common/Textarea/PromptEditor/utils.ts b/packages/web/components/common/Textarea/PromptEditor/utils.ts index 15ff217f0..80b721533 100644 --- a/packages/web/components/common/Textarea/PromptEditor/utils.ts +++ b/packages/web/components/common/Textarea/PromptEditor/utils.ts @@ -102,12 +102,6 @@ export function registerLexicalTextEntity { - return rawSearch - .map((item) => { - const currentFilterItem = quoteList?.find((res) => res._id === item.id); - + const processedData = rawSearch.map((item) => { + if (chatItemDataId && quoteList) { + const currentFilterItem = quoteList.find((res) => res._id === item.id); return { ...item, q: currentFilterItem?.q || '', a: currentFilterItem?.a || '' }; - }) - .sort((a, b) => { - const aScore = formatScore(a.score); - const bScore = formatScore(b.score); - return (bScore.primaryScore?.value || 0) - (aScore.primaryScore?.value || 0); - }); - }, [quoteList, rawSearch]); + } + + return item; + }); + + return processedData.sort((a, b) => { + const aScore = formatScore(a.score); + const bScore = formatScore(b.score); + return (bScore.primaryScore?.value || 0) - (aScore.primaryScore?.value || 0); + }); + }, [rawSearch, quoteList, chatItemDataId]); return ( <> diff --git a/projects/app/src/pageComponents/chat/ChatQuoteList/QuoteItem.tsx b/projects/app/src/pageComponents/chat/ChatQuoteList/QuoteItem.tsx index b917ea5be..80b9d25d2 100644 --- a/projects/app/src/pageComponents/chat/ChatQuoteList/QuoteItem.tsx +++ b/projects/app/src/pageComponents/chat/ChatQuoteList/QuoteItem.tsx @@ -64,13 +64,15 @@ const QuoteItem = ({ fontSize={'10px'} h={'full'} alignItems={'center'} + mr={1} + flexShrink={0} > {index + 1} {score && !isDeleted && ( - + )} diff --git a/projects/app/src/pages/api/core/app/exportChatLogs.ts b/projects/app/src/pages/api/core/app/exportChatLogs.ts index 78dfd315f..7b357b339 100644 --- a/projects/app/src/pages/api/core/app/exportChatLogs.ts +++ b/projects/app/src/pages/api/core/app/exportChatLogs.ts @@ -67,7 +67,6 @@ async function handler(req: ApiRequestProps, res: NextAp } } ]); - console.log(teamMemberWithContact); const where = { teamId: new Types.ObjectId(teamId), @@ -161,7 +160,7 @@ async function handler(req: ApiRequestProps, res: NextAp }, chatDetails: { $map: { - input: '$chatitems', + input: { $slice: ['$chatitems', -1000] }, as: 'item', in: { id: '$$item._id',