Skip to content

Open source CapCut alternative.

TypeScript

fix(site): keep a failed models probe out of the AI panel

David Le44be0c6347c1
diff --git a/site/src/cut/components/AiPanel.tsx b/site/src/cut/components/AiPanel.tsx
index 015c589c..280fb2f9 100644
--- a/site/src/cut/components/AiPanel.tsx
+++ b/site/src/cut/components/AiPanel.tsx
@@ -602,7 +602,11 @@ export function AiPanel({
let alive = true;
void localBackend
.fetch("/api/cut/ai/models")
- .then((r) => r.json())
+ .then((r) => {
+ // An error body carries no provider list.
+ if (!r.ok) throw new Error(`models probe answered ${r.status}`);
+ return r.json();
+ })
.then((d: ModelsInfo) => alive && setInfo(d))
.catch(() => {});
return () => {