Skip to content

Commit 6510416

Browse files
committed
chore: use modelid from db
1 parent 59dd855 commit 6510416

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

app/api/chat/route.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import cl100k_base from "tiktoken/encoders/cl100k_base.json";
66
import { Tiktoken } from "tiktoken/lite";
77

88
import { apiEndpoint, apiKey, imgGenFnModel, DEFAULT_SYSTEM_PROMPT } from '@/app/config/api';
9-
import { defaultModel, createConfigToApiIdMap } from '@/app/config/models';
9+
import { defaultModel } from '@/app/config/models';
1010
import { withSessionAuth } from '@/lib/auth';
1111
import { getAvailableModelsForUser } from '@/lib/models';
1212
import { checkTokenLimit, incrementTokenUsageWithMultiplier, getClientIP, getRateLimitConfigForUser, storeConversationTokens } from '@/lib/rate-limit';
@@ -366,10 +366,8 @@ async function handlePostRequest(req: NextRequest) {
366366

367367
return createDataStreamResponse({
368368
execute: async dataStream => {
369-
// Map config model ID to API model ID if needed
370-
const configToApiIdMap = createConfigToApiIdMap();
371-
const apiModelId = configToApiIdMap.get(model || defaultModel) || model || defaultModel;
372-
369+
const apiModelId = dbModel.api_id || dbModel.model_id || defaultModel;
370+
373371
const result = streamText({
374372
model: openaiClient(apiModelId),
375373
messages: messagesToSend,

0 commit comments

Comments
 (0)