adding sydney in progress. only uses jailbreakConvoId and parentMsgId

This commit is contained in:
Daniel Avila 2023-03-08 21:06:58 -05:00
parent 69b3edc52c
commit 2c1ae68dc4
11 changed files with 53 additions and 41 deletions

View file

@ -10,7 +10,7 @@ const askBing = async ({ text, progressCallback, convo }) => {
// If the above doesn't work, provide all your cookies as a string instead
// cookies: '',
debug: false,
cache: new KeyvFile({ filename: './data/cache.json' })
cache: { store: new KeyvFile({ filename: './data/cache.json' }) }
});
let options = {

View file

@ -10,7 +10,7 @@ const askSydney = async ({ text, progressCallback, convo }) => {
// If the above doesn't work, provide all your cookies as a string instead
// cookies: '',
debug: false,
cache: new KeyvFile({ filename: './data/cache.json' })
cache: { store: new KeyvFile({ filename: './data/cache.json' }) }
});
let options = {
@ -18,10 +18,12 @@ const askSydney = async ({ text, progressCallback, convo }) => {
onProgress: async (partialRes) => await progressCallback(partialRes),
};
if (convo) {
options = { ...options, ...convo };
if (convo.parentMessageId) {
options = { ...options, jailbreakConversationId: convo.jailbreakConversationId, parentMessageId: convo.parentMessageId };
}
console.log('sydney options', options);
const res = await sydneyClient.sendMessage(text, options
);

View file

@ -13,7 +13,8 @@ const {
const { getConvo, saveMessage, deleteMessages, saveConvo } = require('../../models');
const { handleError, sendMessage } = require('./handlers');
router.use('/bing', askSydney);
router.use('/bing', askBing);
router.use('/sydney', askSydney);
router.post('/', async (req, res) => {
let { model, text, parentMessageId, conversationId, chatGptLabel, promptPrefix } = req.body;

View file

@ -38,7 +38,7 @@ router.post('/', async (req, res) => {
convo
});
console.log('CLIENT RESPONSE');
console.log('BING RESPONSE');
console.dir(response, { depth: null });
userMessage.conversationSignature =

View file

@ -38,8 +38,8 @@ router.post('/', async (req, res) => {
convo
});
console.log('CLIENT RESPONSE');
console.dir(response, { depth: null });
console.log('SYDNEY RESPONSE');
// console.dir(response, { depth: null });
userMessage.conversationSignature =
convo.conversationSignature || response.conversationSignature;
@ -47,7 +47,7 @@ router.post('/', async (req, res) => {
userMessage.invocationId = response.invocationId;
userMessage.jailbreakConversationId = convo.jailbreakConversationId || response.jailbreakConversationId;
await saveMessage(userMessage);
if (!convo.conversationSignature) {
response.title = await titleConvo({
model,
@ -55,8 +55,9 @@ router.post('/', async (req, res) => {
response: JSON.stringify(response.response)
});
}
response.text = response.response;
response.parentMessageId = convo.parentMessageId || response.messageId;
response.id = response.details.messageId;
response.suggestions =
response.details.suggestedResponses &&