From dcb175bf0cd10c28e476a566cee648a0dba4238e Mon Sep 17 00:00:00 2001 From: wusumac <736139669@qq.com> Date: Sun, 2 Aug 2026 22:57:19 +0800 Subject: [PATCH] fix(web): guard the custom Claude models fetch against partial api clients --- web/src/components/NewSession/index.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/web/src/components/NewSession/index.tsx b/web/src/components/NewSession/index.tsx index c6c5953f..6f1b00de 100644 --- a/web/src/components/NewSession/index.tsx +++ b/web/src/components/NewSession/index.tsx @@ -269,13 +269,18 @@ export function NewSession(props: { if (!props.api) { return } - props.api.getClaudeCustomModels().then((result) => { - if (!cancelled) { - setClaudeCustomModels(Array.isArray(result.models) ? result.models : []) - } - }).catch(() => { - // Custom models are optional — fall back to the built-in presets. - }) + try { + props.api.getClaudeCustomModels().then((result) => { + if (!cancelled) { + setClaudeCustomModels(Array.isArray(result.models) ? result.models : []) + } + }).catch(() => { + // Custom models are optional — fall back to the built-in presets. + }) + } catch { + // Partial api clients (tests, older hub versions) without the + // method must not break the New Session form. + } return () => { cancelled = true }