Spaces:
Paused
Paused
icebear0828 Claude Opus 4.6 commited on
Commit ·
c231bc0
1
Parent(s): 9b752b4
fix: use catalog isDefault instead of hardcoded gpt-5.4 in dashboard
Browse filesThe dashboard hardcoded gpt-5.4 as default/fallback model, but it was
removed from the catalog. Now uses the catalog's isDefault flag to
dynamically select the default model (gpt-5.2-codex).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
shared/hooks/use-status.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { useState, useEffect, useCallback, useMemo } from "preact/hooks";
|
|
| 3 |
export interface CatalogModel {
|
| 4 |
id: string;
|
| 5 |
displayName: string;
|
|
|
|
| 6 |
supportedReasoningEfforts: { reasoningEffort: string; description: string }[];
|
| 7 |
defaultReasoningEffort: string;
|
| 8 |
}
|
|
@@ -44,8 +45,8 @@ function isTierVariant(id: string): boolean {
|
|
| 44 |
export function useStatus(accountCount: number) {
|
| 45 |
const [baseUrl, setBaseUrl] = useState("Loading...");
|
| 46 |
const [apiKey, setApiKey] = useState("Loading...");
|
| 47 |
-
const [models, setModels] = useState<string[]>([
|
| 48 |
-
const [selectedModel, setSelectedModel] = useState("
|
| 49 |
const [modelCatalog, setModelCatalog] = useState<CatalogModel[]>([]);
|
| 50 |
const [selectedEffort, setSelectedEffort] = useState("medium");
|
| 51 |
const [selectedSpeed, setSelectedSpeed] = useState<string | null>(null);
|
|
@@ -63,11 +64,11 @@ export function useStatus(accountCount: number) {
|
|
| 63 |
const ids: string[] = data.data.map((m: { id: string }) => m.id);
|
| 64 |
if (ids.length > 0) {
|
| 65 |
setModels(ids);
|
| 66 |
-
const
|
| 67 |
-
|
| 68 |
}
|
| 69 |
} catch {
|
| 70 |
-
setModels([
|
| 71 |
}
|
| 72 |
}, []);
|
| 73 |
|
|
|
|
| 3 |
export interface CatalogModel {
|
| 4 |
id: string;
|
| 5 |
displayName: string;
|
| 6 |
+
isDefault: boolean;
|
| 7 |
supportedReasoningEfforts: { reasoningEffort: string; description: string }[];
|
| 8 |
defaultReasoningEffort: string;
|
| 9 |
}
|
|
|
|
| 45 |
export function useStatus(accountCount: number) {
|
| 46 |
const [baseUrl, setBaseUrl] = useState("Loading...");
|
| 47 |
const [apiKey, setApiKey] = useState("Loading...");
|
| 48 |
+
const [models, setModels] = useState<string[]>([]);
|
| 49 |
+
const [selectedModel, setSelectedModel] = useState("");
|
| 50 |
const [modelCatalog, setModelCatalog] = useState<CatalogModel[]>([]);
|
| 51 |
const [selectedEffort, setSelectedEffort] = useState("medium");
|
| 52 |
const [selectedSpeed, setSelectedSpeed] = useState<string | null>(null);
|
|
|
|
| 64 |
const ids: string[] = data.data.map((m: { id: string }) => m.id);
|
| 65 |
if (ids.length > 0) {
|
| 66 |
setModels(ids);
|
| 67 |
+
const defaultModel = catalogData.find((m) => m.isDefault)?.id ?? ids[0] ?? "";
|
| 68 |
+
setSelectedModel(defaultModel);
|
| 69 |
}
|
| 70 |
} catch {
|
| 71 |
+
setModels([]);
|
| 72 |
}
|
| 73 |
}, []);
|
| 74 |
|