From a7b45266505b1e5903421736b2512e8e02a6f1e0 Mon Sep 17 00:00:00 2001 From: slytechnical Date: Fri, 16 May 2025 19:03:04 -0500 Subject: [PATCH] simpler getModel --- src/api/providers/router-provider.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/api/providers/router-provider.ts b/src/api/providers/router-provider.ts index 37557a3af0..548ce6cdf0 100644 --- a/src/api/providers/router-provider.ts +++ b/src/api/providers/router-provider.ts @@ -56,21 +56,17 @@ export abstract class RouterProvider extends BaseProvider { } override getModel(): { id: string; info: ModelInfo } { - const userSpecifiedModelId = this.modelId - - // Priority 1: Use user-specified model if it's valid and found in fetched models - if (userSpecifiedModelId && this.models[userSpecifiedModelId]) { - return { id: userSpecifiedModelId, info: this.models[userSpecifiedModelId] } + // Try user-specified model first + if (this.modelId && this.models[this.modelId]) { + return { id: this.modelId, info: this.models[this.modelId] } } - // Priority 2: If user-specified model is not found (or not specified at all), - // try the provider's default model ID with its fetched info (if available). + // Try default model with fetched info if (this.models[this.defaultModelId]) { return { id: this.defaultModelId, info: this.models[this.defaultModelId] } } - // Priority 3: Ultimate fallback: provider's default model ID with its (static) defaultModelInfo. - // This is reached if userSpecifiedModelId was invalid/not found AND this.defaultModelId was also not in this.models. + // Fallback to default model with static info return { id: this.defaultModelId, info: this.defaultModelInfo } }