From 8986c5680b79d476d7e75364989512723157b99d Mon Sep 17 00:00:00 2001 From: baiqing Date: Fri, 22 May 2026 22:28:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(settings):=20performSwitch=20=E8=A1=A5=20ca?= =?UTF-8?q?tch=20=E2=80=94=20=E6=9C=AC=E5=9C=B0=20ASR=20=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E4=B8=8D=E5=86=8D=E8=A3=B8=E6=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LocalModelSection.performSwitch 是 async、try/finally 无 catch,而调用方 (Qwen3 / Foundry / sherpa Toggle、禁用按钮)都是 void performSwitch(...) 即发即忘。setActiveAsrProvider / updatePrefs 失败会冒成未处理的 promise rejection。补 catch + console.error 吞掉。 --- openless-all/app/src/pages/settings/LocalModelSection.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openless-all/app/src/pages/settings/LocalModelSection.tsx b/openless-all/app/src/pages/settings/LocalModelSection.tsx index 6eeee1c4..222cfbde 100644 --- a/openless-all/app/src/pages/settings/LocalModelSection.tsx +++ b/openless-all/app/src/pages/settings/LocalModelSection.tsx @@ -43,6 +43,10 @@ export function LocalModelSection() { if (prefs) { await updatePrefs({ ...prefs, activeAsrProvider: target }); } + } catch (err) { + // 调用方是 void performSwitch(...) 即发即忘 —— 这里吞掉并记日志,否则 IPC + // 失败会冒成未处理的 promise rejection。 + console.error('[settings] switch local ASR provider failed', err); } finally { if (seq === switchSeqRef.current) { setBusy(false);