From 4f86a0591cc889edd2c514d025382d28c2e03506 Mon Sep 17 00:00:00 2001 From: Archer <545436317@qq.com> Date: Thu, 27 Mar 2025 18:45:30 +0800 Subject: [PATCH] perf: update test model ux (#4375) * perf: update test model ux * feat: oceanbase vector db doc --- .../zh-cn/docs/development/upgrading/492.md | 9 +- .../account/model/Channel/ModelTest.tsx | 98 +++++++++---------- 2 files changed, 55 insertions(+), 52 deletions(-) diff --git a/docSite/content/zh-cn/docs/development/upgrading/492.md b/docSite/content/zh-cn/docs/development/upgrading/492.md index 617ce6b72..8bb1d8368 100644 --- a/docSite/content/zh-cn/docs/development/upgrading/492.md +++ b/docSite/content/zh-cn/docs/development/upgrading/492.md @@ -8,6 +8,11 @@ weight: 798 --- ## 更新指南 +### 配置参数变更 + +修改`config.json`文件中`systemEnv.pgHNSWEfSearch`参数名,改成`hnswEfSearch`。 +商业版用户直接在后台`系统配置-基础配置`中进行变更。 + ### SSO 迁移 使用了 SSO 或成员同步的商业版用户,并且是对接`钉钉`、`企微`的,需要迁移已有的 SSO 相关配置: @@ -29,6 +34,7 @@ weight: 798 3. 外部变量改名:自定义变量。 并且支持在测试时调试,在分享链接中,该变量直接隐藏。 4. 集合同步时,支持同步修改标题。 5. 团队成员管理重构,抽离主流 IM SSO(企微、飞书、钉钉),并支持通过自定义 SSO 接入 FastGPT。同时完善与外部系统的成员同步。 +6. 支持 `oceanbase` 向量数据库。填写环境变量`OCEANBASE_URL`即可。 ## ⚙️ 优化 @@ -41,7 +47,8 @@ weight: 798 7. 工作流节点数组类型,自动进行 JSON parse 解析 string 输入。 8. AI proxy 日志优化,去除重试失败的日志,仅保留最后一份错误日志。 9. 个人信息和通知展示优化。 -10. 分块算法小调整: +10. 模型测试 loading 动画优化。 +11. 分块算法小调整: * 跨处理符号之间连续性更强。 * 代码块分割时,用 LLM 模型上下文作为分块大小,尽可能保证代码块完整性。 * 表格分割时,用 LLM 模型上下文作为分块大小,尽可能保证表格完整性。 diff --git a/projects/app/src/pageComponents/account/model/Channel/ModelTest.tsx b/projects/app/src/pageComponents/account/model/Channel/ModelTest.tsx index cafca4a0b..294dffa76 100644 --- a/projects/app/src/pageComponents/account/model/Channel/ModelTest.tsx +++ b/projects/app/src/pageComponents/account/model/Channel/ModelTest.tsx @@ -97,53 +97,49 @@ const ModelTest = ({ const { runAsync: onStartTest, loading: isAnyModelLoading } = useRequest2( async () => { - try { - let errorNum = 0; - const testModel = async (model: string) => { + let errorNum = 0; + setTestModelList((prev) => prev.map((item) => ({ ...item, loading: true }))); + + const testModel = async (model: string) => { + setTestModelList((prev) => + prev.map((item) => + item.model === model ? { ...item, status: 'running', message: '' } : item + ) + ); + const start = Date.now(); + try { + await getTestModel({ model, channelId }); + const duration = Date.now() - start; setTestModelList((prev) => prev.map((item) => item.model === model - ? { ...item, status: 'running', message: '', loading: true } + ? { ...item, status: 'success', duration: duration / 1000, loading: false } : item ) ); - const start = Date.now(); - try { - await getTestModel({ model, channelId }); - const duration = Date.now() - start; - setTestModelList((prev) => - prev.map((item) => - item.model === model - ? { ...item, status: 'success', duration: duration / 1000, loading: false } - : item - ) - ); - } catch (error) { - setTestModelList((prev) => - prev.map((item) => - item.model === model - ? { ...item, status: 'error', message: getErrText(error), loading: false } - : item - ) - ); - errorNum++; - } - }; - - await batchRun( - testModelList.map((item) => item.model), - testModel, - 5 - ); - - if (errorNum > 0) { - toast({ - status: 'warning', - title: t('account_model:test_failed', { num: errorNum }) - }); + } catch (error) { + setTestModelList((prev) => + prev.map((item) => + item.model === model + ? { ...item, status: 'error', message: getErrText(error), loading: false } + : item + ) + ); + errorNum++; } - } catch (error) { - console.error('Error during model testing:', error); + }; + + await batchRun( + testModelList.map((item) => item.model), + testModel, + 5 + ); + + if (errorNum > 0) { + toast({ + status: 'warning', + title: t('account_model:test_failed', { num: errorNum }) + }); } }, { @@ -187,6 +183,8 @@ const ModelTest = ({ } ); + const isTesting = isAnyModelLoading || testingOneModel; + return ( - onTestOneModel(item.model)} - /> + {(!isAnyModelLoading || item.loading) && ( + onTestOneModel(item.model)} + /> + )} ); @@ -248,11 +248,7 @@ const ModelTest = ({ -