Compare commits

..

2 Commits

Author SHA1 Message Date
Stef Dunlap 6ab972368a Fixup 2023-03-09 17:29:05 -05:00
Stef Dunlap 22d0b8a412 :space invaders: 2023-03-09 00:27:44 -05:00
1 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,6 @@
#!/usr/bin/env node
//IRC bot that responds to !chat, queries the chatgpt api, and prints the response line by line
const fs = require('fs');
const irc = require('irc');
const axios = require('axios');
const config = require('./config.json');
@ -51,9 +52,9 @@ class Context {
}
}
let context = new Context(savedMessages);
let context = null;
if (fs.existsSync('./messages.json')) {
savedMessages = require('./messages.json');
const savedMessages = require('./messages.json');
context = new Context(savedMessages);
} else {
context = new Context(seed_messages);
@ -76,7 +77,7 @@ client.addListener('message', async (from, to, message) => {
if(is_chat_cmd && !config.alwaysRemember) {
context.clear();
}
context.add_user_prompt(query);
context.add_user_prompt(message);
const query = message.slice(6);
try {
await chatgpt(query, context.messages, handleChatGPTResponseLine);