From d8bd296a825a51ab725b1424d6fb801980733208 Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Thu, 26 Sep 2024 12:15:18 +0100 Subject: [PATCH] chore: remove t.optional and add baseUrl check --- src/handlers/ask-gpt.ts | 5 ++++- src/types/plugin-inputs.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/handlers/ask-gpt.ts b/src/handlers/ask-gpt.ts index f537da4..299cfeb 100644 --- a/src/handlers/ask-gpt.ts +++ b/src/handlers/ask-gpt.ts @@ -21,7 +21,10 @@ export async function askGpt(context: Context, formattedChat: string) { config: { model, openAiBaseUrl }, } = context; - const openAi = new OpenAI({ apiKey: OPENAI_API_KEY, baseURL: openAiBaseUrl }); + const openAi = new OpenAI({ + apiKey: OPENAI_API_KEY, + ...(openAiBaseUrl && { baseUrl: openAiBaseUrl }), + }); const chat = createChatHistory(formattedChat); diff --git a/src/types/plugin-inputs.ts b/src/types/plugin-inputs.ts index a574032..8bfb036 100644 --- a/src/types/plugin-inputs.ts +++ b/src/types/plugin-inputs.ts @@ -20,8 +20,8 @@ export interface PluginInputs