From df332299349352f35edc3dc4e926b12e78ef5b7b Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Sat, 19 Jul 2025 16:14:46 +0530 Subject: [PATCH] feat(custom-openai): use `apiKey` instead of `openAIApiKey` --- src/app/api/chat/route.ts | 2 +- src/app/api/images/route.ts | 2 +- src/app/api/search/route.ts | 2 +- src/app/api/suggestions/route.ts | 2 +- src/app/api/videos/route.ts | 2 +- src/lib/providers/aimlapi.ts | 4 ++-- src/lib/providers/index.ts | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/api/chat/route.ts b/src/app/api/chat/route.ts index e566edb..2d53b75 100644 --- a/src/app/api/chat/route.ts +++ b/src/app/api/chat/route.ts @@ -223,7 +223,7 @@ export const POST = async (req: Request) => { if (body.chatModel?.provider === 'custom_openai') { llm = new ChatOpenAI({ - openAIApiKey: getCustomOpenaiApiKey(), + apiKey: getCustomOpenaiApiKey(), modelName: getCustomOpenaiModelName(), temperature: 0.7, configuration: { diff --git a/src/app/api/images/route.ts b/src/app/api/images/route.ts index db39d9f..e02854d 100644 --- a/src/app/api/images/route.ts +++ b/src/app/api/images/route.ts @@ -49,7 +49,7 @@ export const POST = async (req: Request) => { if (body.chatModel?.provider === 'custom_openai') { llm = new ChatOpenAI({ - openAIApiKey: getCustomOpenaiApiKey(), + apiKey: getCustomOpenaiApiKey(), modelName: getCustomOpenaiModelName(), temperature: 0.7, configuration: { diff --git a/src/app/api/search/route.ts b/src/app/api/search/route.ts index 970ec42..16325de 100644 --- a/src/app/api/search/route.ts +++ b/src/app/api/search/route.ts @@ -81,7 +81,7 @@ export const POST = async (req: Request) => { if (body.chatModel?.provider === 'custom_openai') { llm = new ChatOpenAI({ modelName: body.chatModel?.name || getCustomOpenaiModelName(), - openAIApiKey: + apiKey: body.chatModel?.customOpenAIKey || getCustomOpenaiApiKey(), temperature: 0.7, configuration: { diff --git a/src/app/api/suggestions/route.ts b/src/app/api/suggestions/route.ts index e92e5ec..99179d2 100644 --- a/src/app/api/suggestions/route.ts +++ b/src/app/api/suggestions/route.ts @@ -48,7 +48,7 @@ export const POST = async (req: Request) => { if (body.chatModel?.provider === 'custom_openai') { llm = new ChatOpenAI({ - openAIApiKey: getCustomOpenaiApiKey(), + apiKey: getCustomOpenaiApiKey(), modelName: getCustomOpenaiModelName(), temperature: 0.7, configuration: { diff --git a/src/app/api/videos/route.ts b/src/app/api/videos/route.ts index 34ae7fd..7e8288b 100644 --- a/src/app/api/videos/route.ts +++ b/src/app/api/videos/route.ts @@ -49,7 +49,7 @@ export const POST = async (req: Request) => { if (body.chatModel?.provider === 'custom_openai') { llm = new ChatOpenAI({ - openAIApiKey: getCustomOpenaiApiKey(), + apiKey: getCustomOpenaiApiKey(), modelName: getCustomOpenaiModelName(), temperature: 0.7, configuration: { diff --git a/src/lib/providers/aimlapi.ts b/src/lib/providers/aimlapi.ts index e934362..9c982fe 100644 --- a/src/lib/providers/aimlapi.ts +++ b/src/lib/providers/aimlapi.ts @@ -38,7 +38,7 @@ export const loadAimlApiChatModels = async () => { chatModels[model.id] = { displayName: model.name || model.id, model: new ChatOpenAI({ - openAIApiKey: apiKey, + apiKey: apiKey, modelName: model.id, temperature: 0.7, configuration: { @@ -76,7 +76,7 @@ export const loadAimlApiEmbeddingModels = async () => { embeddingModels[model.id] = { displayName: model.name || model.id, model: new OpenAIEmbeddings({ - openAIApiKey: apiKey, + apiKey: apiKey, modelName: model.id, configuration: { baseURL: API_URL, diff --git a/src/lib/providers/index.ts b/src/lib/providers/index.ts index 4b8a090..1b6bb2f 100644 --- a/src/lib/providers/index.ts +++ b/src/lib/providers/index.ts @@ -118,7 +118,7 @@ export const getAvailableChatModelProviders = async () => { [customOpenAiModelName]: { displayName: customOpenAiModelName, model: new ChatOpenAI({ - openAIApiKey: customOpenAiApiKey, + apiKey: customOpenAiApiKey, modelName: customOpenAiModelName, temperature: 0.7, configuration: {