feat: add provider availability detection and normalize legacy "default" model IDs

This commit is contained in:
Mohamed Boudra
2026-02-12 18:04:21 +07:00
parent 8bdd083512
commit 117bbfe2f4
13 changed files with 487 additions and 43 deletions
+10 -4
View File
@@ -4,11 +4,17 @@ export function extractAgentModel(agent?: Agent | null): string | null {
if (!agent) return null;
const runtimeModel = agent.runtimeInfo?.model;
const fallbackModel = agent.model;
if (typeof runtimeModel === "string" && runtimeModel.trim().length > 0) {
return runtimeModel.trim();
if (typeof runtimeModel === "string") {
const normalized = runtimeModel.trim();
if (normalized.length > 0 && normalized.toLowerCase() !== "default") {
return normalized;
}
}
if (typeof fallbackModel === "string" && fallbackModel.trim().length > 0) {
return fallbackModel.trim();
if (typeof fallbackModel === "string") {
const normalized = fallbackModel.trim();
if (normalized.length > 0 && normalized.toLowerCase() !== "default") {
return normalized;
}
}
return null;
}