From 0643780c63b6e41d07fced907e9c88ab8042a8f2 Mon Sep 17 00:00:00 2001 From: Xin Wang Date: Mon, 9 Feb 2026 08:51:44 +0800 Subject: [PATCH] Fix runtime config debug drawer --- web/pages/Assistants.tsx | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/web/pages/Assistants.tsx b/web/pages/Assistants.tsx index 978fc3d..a492835 100644 --- a/web/pages/Assistants.tsx +++ b/web/pages/Assistants.tsx @@ -1193,19 +1193,32 @@ export const DebugDrawer: React.FC<{ const buildLocalResolvedRuntime = () => { const warnings: string[] = []; const services: Record = {}; + const isExternalLlm = assistant.configMode === 'dify' || assistant.configMode === 'fastgpt'; - if (assistant.llmModelId) { - const llm = llmModels.find((item) => item.id === assistant.llmModelId); - if (llm) { - services.llm = { - provider: 'openai', - model: llm.modelName || llm.name, - apiKey: llm.apiKey, - baseUrl: llm.baseUrl, - }; - } else { - warnings.push(`LLM model not found in loaded list: ${assistant.llmModelId}`); - } + if (isExternalLlm) { + services.llm = { + provider: 'openai', + model: '', + apiKey: assistant.apiKey || '', + baseUrl: assistant.apiUrl || '', + }; + if (!assistant.apiUrl) warnings.push(`External LLM API URL is empty for mode: ${assistant.configMode}`); + if (!assistant.apiKey) warnings.push(`External LLM API key is empty for mode: ${assistant.configMode}`); + } else if (assistant.llmModelId) { + const llm = llmModels.find((item) => item.id === assistant.llmModelId); + if (llm) { + services.llm = { + provider: 'openai', + model: llm.modelName || llm.name, + apiKey: llm.apiKey, + baseUrl: llm.baseUrl, + }; + } else { + warnings.push(`LLM model not found in loaded list: ${assistant.llmModelId}`); + } + } else { + // Keep empty object to indicate engine should use default provider model. + services.llm = {}; } if (assistant.asrModelId) { @@ -1245,9 +1258,10 @@ export const DebugDrawer: React.FC<{ const localResolved = { assistantId: assistant.id, sources: { - llmModelId: assistant.llmModelId || '', + llmModelId: isExternalLlm ? '' : (assistant.llmModelId || ''), asrModelId: assistant.asrModelId || '', voiceId: assistant.voice || '', + llmConfigMode: assistant.configMode || 'platform', }, warnings, sessionStartMetadata: {