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

@ -1,7 +1,7 @@
require('dotenv').config();
const { KeyvFile } = require('keyv-file');
const askSydney = async ({ text, progressCallback, convo }) => {
const askSydney = async ({ text, onProgress, convo }) => {
const { BingAIClient } = (await import('@waylaidwanderer/chatgpt-api'));
const sydneyClient = new BingAIClient({
@ -15,10 +15,10 @@ const askSydney = async ({ text, progressCallback, convo }) => {
let options = {
jailbreakConversationId: true,
onProgress: async (partialRes) => await progressCallback(partialRes),
onProgress,
};
if (convo.parentMessageId) {
if (convo.jailbreakConversationId) {
options = { ...options, jailbreakConversationId: convo.jailbreakConversationId, parentMessageId: convo.parentMessageId };
}