feat: complete bing styles (bing is passed tone style)

This commit is contained in:
Daniel Avila 2023-03-25 09:40:36 -04:00
parent b07b74ba54
commit 26e7a715e0

View file

@ -2,7 +2,7 @@ require('dotenv').config();
const { KeyvFile } = require('keyv-file'); const { KeyvFile } = require('keyv-file');
const askBing = async ({ text, onProgress, convo }) => { const askBing = async ({ text, onProgress, convo }) => {
const { BingAIClient } = (await import('@waylaidwanderer/chatgpt-api')); const { BingAIClient } = await import('@waylaidwanderer/chatgpt-api');
const bingAIClient = new BingAIClient({ const bingAIClient = new BingAIClient({
// "_U" cookie from bing.com // "_U" cookie from bing.com
@ -11,7 +11,7 @@ const askBing = async ({ text, onProgress, convo }) => {
// cookies: '', // cookies: '',
debug: false, debug: false,
cache: { store: new KeyvFile({ filename: './data/cache.json' }) }, cache: { store: new KeyvFile({ filename: './data/cache.json' }) },
proxy: process.env.PROXY || null, proxy: process.env.PROXY || null
}); });
let options = { onProgress }; let options = { onProgress };
@ -19,8 +19,15 @@ const askBing = async ({ text, onProgress, convo }) => {
options = { ...options, ...convo }; options = { ...options, ...convo };
} }
if (options?.jailbreakConversationId == 'false') if (options?.jailbreakConversationId == 'false') {
options.jailbreakConversationId = false options.jailbreakConversationId = false;
}
if (convo.toneStyle) {
options.toneStyle = convo.toneStyle;
}
console.log('bing options', options);
const res = await bingAIClient.sendMessage(text, options); const res = await bingAIClient.sendMessage(text, options);