From dbdae65e9befc5d24cacfd7b1096355f8748d266 Mon Sep 17 00:00:00 2001 From: "jackson.jia" Date: Tue, 26 May 2026 14:24:17 +0800 Subject: [PATCH] fix(input-field): wrong toast when selecting built-in agents other than quick-answer / smart-reasoning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When selecting an agent from the chat page's agent selector dropdown, built-in agents other than `builtin-quick-answer` and `builtin-smart-reasoning` trigger the wrong toast. "Switched to Intelligent Reasoning" pops up regardless of which agent was actually picked — Wiki Questioner, Data Analyst, Wiki Fixer, etc. Root cause: the toast logic checks only `agent.is_builtin`, then branches on `agent_mode === 'smart-reasoning'` to pick between the "Switched to Intelligent Reasoning" / "Switched to Quick Q&A" strings. Those strings were designed for the two original built-ins (`builtin-quick-answer` and `builtin-smart-reasoning`), which the dropdown re-brands as "Normal Mode" / "Agent Mode". They don't make sense for any other built-in. Narrow the special-case branch to those two IDs. Other built-ins fall back to the generic `agentSelected` toast (the path custom agents already take), so they get a toast naming the agent that was actually selected. --- frontend/src/components/Input-field.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Input-field.vue b/frontend/src/components/Input-field.vue index 404e12b0..fd6b5f47 100644 --- a/frontend/src/components/Input-field.vue +++ b/frontend/src/components/Input-field.vue @@ -1810,7 +1810,15 @@ const handleSelectAgent = (agent: CustomAgent, sourceTenantId?: string) => { showAgentModeSelector.value = false; - const message = agent.is_builtin + // Only the two "mode-entry" built-ins are re-branded as "Normal / Agent Mode" + // in the dropdown — the switched-on/off toasts only make sense for them. + // Other built-ins (wiki researcher, data analyst, etc.) share `is_builtin` + // but should fall back to the generic agentSelected toast like custom agents, + // otherwise selecting e.g. the Wiki Questioner incorrectly says + // "Switched to Intelligent Reasoning". + const isModeBuiltin = + agent.id === BUILTIN_QUICK_ANSWER_ID || agent.id === BUILTIN_SMART_REASONING_ID; + const message = isModeBuiltin ? (isAgentType ? t('input.messages.agentSwitchedOn') : t('input.messages.agentSwitchedOff')) : t('input.messages.agentSelected', { name: agent.name }); MessagePlugin.success(message);