chore: refactor progressCB to one place, fix sydney, and sanitize html

This commit is contained in:
Danny Avila 2023-03-14 15:42:59 -04:00
parent 9a17e94f8f
commit 2e20b28c4d
12 changed files with 351 additions and 69 deletions

View file

@ -9,17 +9,14 @@ const clientOptions = {
debug: false
};
const askClient = async ({ text, progressCallback, convo }) => {
const askClient = async ({ text, onProgress, convo }) => {
const ChatGPTClient = (await import('@waylaidwanderer/chatgpt-api')).default;
const store = {
store: new KeyvFile({ filename: './data/cache.json' })
};
const client = new ChatGPTClient(process.env.OPENAI_KEY, clientOptions, store);
let options = {
onProgress: async (partialRes) => await progressCallback(partialRes)
};
let options = { onProgress };
if (!!convo.parentMessageId && !!convo.conversationId) {
options = { ...options, ...convo };