From 30a1f2afe9ab71b4fe0418d313847e30b3f771c6 Mon Sep 17 00:00:00 2001 From: zhaoying Date: Fri, 26 Dec 2025 15:25:33 +0800 Subject: [PATCH] fix(web): update get llm,chat model list function --- web/src/views/ApplicationConfig/Agent.tsx | 11 ++++------- web/src/views/MemoryExtractionEngine/index.tsx | 11 ++++------- .../SpaceManagement/components/SpaceModal.tsx | 11 ++++------- web/src/views/ToolManagement/Custom.tsx | 2 +- .../Editor/plugin/InitialValuePlugin.tsx | 14 +++++++++++--- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/web/src/views/ApplicationConfig/Agent.tsx b/web/src/views/ApplicationConfig/Agent.tsx index d4206fbd..436cd74f 100644 --- a/web/src/views/ApplicationConfig/Agent.tsx +++ b/web/src/views/ApplicationConfig/Agent.tsx @@ -308,13 +308,10 @@ const Agent = forwardRef((_props, ref) => { }) } const getModels = () => { - const requests = [getModelList({ type: 'llm', pagesize: 100, page: 1 }), getModelList({ type: 'chat', pagesize: 100, page: 1 })] - Promise.all(requests) - .then(responses => { - const [chatRes, modelRes] = responses as { items: Model[] }[] - const chatList = chatRes.items || [] - const modelList = modelRes.items || [] - setModelList([...chatList, ...modelList]) + getModelList({ type: 'llm,chat', pagesize: 100, page: 1 }) + .then(res => { + const response = res as { items: Model[] } + setModelList(response.items) }) } const handleAddModel = () => { diff --git a/web/src/views/MemoryExtractionEngine/index.tsx b/web/src/views/MemoryExtractionEngine/index.tsx index ac7b3b70..adade5da 100644 --- a/web/src/views/MemoryExtractionEngine/index.tsx +++ b/web/src/views/MemoryExtractionEngine/index.tsx @@ -54,13 +54,10 @@ const MemoryExtractionEngine: FC = () => { }, [values]) const getModels = () => { - const requests = [getModelList({ type: 'llm', pagesize: 100, page: 1 }), getModelList({ type: 'chat', pagesize: 100, page: 1 })] - Promise.all(requests) - .then(responses => { - const [chatRes, modelRes] = responses as { items: Model[] }[] - const chatList = chatRes.items || [] - const modelList = modelRes.items || [] - setModelList([...chatList, ...modelList]) + getModelList({ type: 'llm,chat', pagesize: 100, page: 1 }) + .then(res => { + const response = res as { items: Model[] } + setModelList(response.items) }) } diff --git a/web/src/views/SpaceManagement/components/SpaceModal.tsx b/web/src/views/SpaceManagement/components/SpaceModal.tsx index 8596cceb..1f07b169 100644 --- a/web/src/views/SpaceManagement/components/SpaceModal.tsx +++ b/web/src/views/SpaceManagement/components/SpaceModal.tsx @@ -80,13 +80,10 @@ const SpaceModal = forwardRef(({ }, []) const getModels = () => { - const requests = [getModelList({ type: 'llm', pagesize: 100, page: 1 }), getModelList({ type: 'chat', pagesize: 100, page: 1 })] - Promise.all(requests) - .then(responses => { - const [chatRes, modelRes] = responses as { items: Model[] }[] - const chatList = chatRes.items || [] - const modelList = modelRes.items || [] - setModelList([...chatList, ...modelList]) + getModelList({ type: 'llm,chat', pagesize: 100, page: 1 }) + .then(res => { + const response = res as { items: Model[] } + setModelList(response.items) }) } diff --git a/web/src/views/ToolManagement/Custom.tsx b/web/src/views/ToolManagement/Custom.tsx index 0be9cc10..4bfcdd50 100644 --- a/web/src/views/ToolManagement/Custom.tsx +++ b/web/src/views/ToolManagement/Custom.tsx @@ -14,7 +14,7 @@ import type { ToolItem, Query, CustomToolModalRef } from './types'; import CustomToolModal from './components/CustomToolModal'; import SearchInput from '@/components/SearchInput' import BodyWrapper from '@/components/Empty/BodyWrapper' -import RbCard from '@/components/RbCard' +import RbCard from '@/components/RbCard/Card' import { getTools, deleteTool } from '@/api/tools' const Custom: React.FC<{ getStatusTag: (status: string) => ReactNode }> = ({ getStatusTag }) => { diff --git a/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx b/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx index 05043436..9bcb5f30 100644 --- a/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx +++ b/web/src/views/Workflow/components/Editor/plugin/InitialValuePlugin.tsx @@ -25,9 +25,17 @@ const InitialValuePlugin: React.FC = ({ value, suggesti parts.forEach(part => { const match = part.match(/^\{\{([^.]+)\.([^}]+)\}\}$/); + if (match) { - const [, nodeId, label] = match; - const suggestion = suggestions.find(s => s.nodeData.id === nodeId && s.label === label); + const [_, nodeId, label] = match; + + const suggestion = suggestions.find(s => { + if (nodeId === 'sys') { + return s.nodeData.type === 'start' && s.label === `sys.${label}` + } + return s.nodeData.id === nodeId && s.label === label + }); + if (suggestion) { paragraph.append($createVariableNode(suggestion)); } else { @@ -43,7 +51,7 @@ const InitialValuePlugin: React.FC = ({ value, suggesti initializedRef.current = true; } - }, []); + }, [suggestions]); return null; };