diff --git a/src/utils/router.ts b/src/utils/router.ts index 2743d45..22129f6 100644 --- a/src/utils/router.ts +++ b/src/utils/router.ts @@ -64,6 +64,16 @@ const calculateTokenCount = ( const getUseModel = async (req: any, tokenCount: number, config: any) => { if (req.body.model.includes(",")) { + const [provider, model] = req.body.model.split(","); + const finalProvider = config.Providers.find( + (p: any) => p.name.toLowerCase() === provider + ); + const finalModel = finalProvider?.models?.find( + (m: any) => m.name.toLowerCase() === model + ); + if (finalProvider && finalModel) { + return `${finalProvider.name},${finalModel}`; + } return req.body.model; } // if tokenCount is greater than the configured threshold, use the long context model