Skip to content

Commit

Permalink
fix: allow using null for default OpenAI endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
codedealer committed Jun 19, 2024
1 parent 00ffd7b commit 3195f4d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/chat/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3195f4d

Please sign in to comment.