diff --git a/app/api/anthropic/[...path]/route.ts b/app/api/anthropic/[...path]/route.ts index 495002b8f..78106efa7 100644 --- a/app/api/anthropic/[...path]/route.ts +++ b/app/api/anthropic/[...path]/route.ts @@ -146,8 +146,8 @@ async function request(req: NextRequest) { if ( isModelAvailableInServer( serverConfig.customModels, - jsonBody?.model, - ServiceProvider.Anthropic, + jsonBody?.model as string, + ServiceProvider.Anthropic as string, ) ) { return NextResponse.json( diff --git a/app/api/common.ts b/app/api/common.ts index c2dfed4ab..1454fde2e 100644 --- a/app/api/common.ts +++ b/app/api/common.ts @@ -97,13 +97,13 @@ export async function requestOpenai(req: NextRequest) { if ( isModelAvailableInServer( serverConfig.customModels, - jsonBody?.model, - ServiceProvider.OpenAI, + jsonBody?.model as string, + ServiceProvider.OpenAI as string, ) || isModelAvailableInServer( serverConfig.customModels, - jsonBody?.model, - ServiceProvider.Azure, + jsonBody?.model as string, + ServiceProvider.Azure as string, ) ) { return NextResponse.json( diff --git a/app/utils/model.ts b/app/utils/model.ts index 741971b00..6b5173a59 100644 --- a/app/utils/model.ts +++ b/app/utils/model.ts @@ -119,9 +119,9 @@ export function collectModelsWithDefaultModel( } export function isModelAvailableInServer( - customModels, - modelName, - providerName, + customModels: string, + modelName: string, + providerName: string, ) { const fullName = `${modelName}@${providerName}`; const modelTable = collectModelTable(DEFAULT_MODELS, customModels);