From 3195f4d4894f740e5a6e04fdb3d7f3372b02098e Mon Sep 17 00:00:00 2001 From: Thomas Mello Date: Thu, 20 Jun 2024 01:50:50 +0300 Subject: [PATCH] fix: allow using null for default OpenAI endpoint --- src/chat/client.ts | 4 ++-- src/index.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chat/client.ts b/src/chat/client.ts index 1e3aa3b..eb03517 100644 --- a/src/chat/client.ts +++ b/src/chat/client.ts @@ -4,8 +4,8 @@ import { MessageLimits } from '@sapphire/discord.js-utilities'; import { trimSentence } from '../lib/utils'; const clientFactory = (config: Config['chat'], token: string) => { - if (!config.endpoint) { - throw new Error('No chat endpoint provided'); + if (!token) { + throw new Error('No API token provided'); } const client = new OpenAI({ diff --git a/src/index.ts b/src/index.ts index 7b5d319..1daa9e8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -82,7 +82,7 @@ const main = async () => { } container.chat = {}; - if (container.appConfig.data.chat.endpoint && process.env.LLM_TOKEN) { + if (process.env.LLM_TOKEN) { container.chat.client = clientFactory(container.appConfig.data.chat, process.env.LLM_TOKEN); if (!container.appConfig.data.chat.promptFile) {