From 284a151f4464560a0a471c2e4bbc42958c145dee Mon Sep 17 00:00:00 2001 From: sp mac bookpro 2605 Date: Mon, 1 Jun 2026 16:12:43 +0800 Subject: [PATCH] refactor: use server-side status and size for knowledge upload --- src/pages/AgentEditor/hooks/useAgentEditor.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/pages/AgentEditor/hooks/useAgentEditor.ts b/src/pages/AgentEditor/hooks/useAgentEditor.ts index fcd3b9c..d330da5 100644 --- a/src/pages/AgentEditor/hooks/useAgentEditor.ts +++ b/src/pages/AgentEditor/hooks/useAgentEditor.ts @@ -162,15 +162,10 @@ export function useAgentEditor({ id, isNew, form, message, navigate }: UseAgentE } try { const result = await AgentAPI.uploadKnowledge(id, [file as File]); - const newFiles = (result.files || []).map((f: any) => ({ - ...f, - status: 'indexing' as const, - size: file.size || 0, - })); setAgent((prev) => { if (!prev) return prev; const existingIds = new Set((prev.knowledge || []).map((k: any) => k.id)); - const uniqueNewFiles = newFiles.filter((f: any) => !existingIds.has(f.id)); + const uniqueNewFiles = (result.files || []).filter((f: any) => !existingIds.has(f.id)); return { ...prev, knowledge: [...uniqueNewFiles, ...(prev.knowledge || [])],