fix: convo resets on model change

This commit is contained in:
Daniel Avila 2023-03-14 21:25:02 -04:00
parent 796d8031e8
commit 918f2fecb6
4 changed files with 64 additions and 40 deletions

View file

@ -0,0 +1,31 @@
export default function createPayload({ convo, message }) {
const endpoint = `/api/ask`;
let payload = { ...message };
const { model } = message;
if (!payload.conversationId)
if (convo?.conversationId && convo?.parentMessageId) {
payload = {
...payload,
conversationId: convo.conversationId,
parentMessageId: convo.parentMessageId || '00000000-0000-0000-0000-000000000000'
};
}
const isBing = model === 'bingai' || model === 'sydney';
if (isBing && convo?.conversationId) {
payload = {
...payload,
jailbreakConversationId: convo.jailbreakConversationId,
conversationId: convo.conversationId,
conversationSignature: convo.conversationSignature,
clientId: convo.clientId,
invocationId: convo.invocationId
};
}
let server = endpoint;
server = model === 'bingai' ? server + '/bing' : server;
server = model === 'sydney' ? server + '/sydney' : server;
return { server, payload };
};