mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-28 22:28:51 +01:00
fix: convo resets on model change
This commit is contained in:
parent
796d8031e8
commit
918f2fecb6
4 changed files with 64 additions and 40 deletions
31
client/src/utils/createPayload.js
Normal file
31
client/src/utils/createPayload.js
Normal 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 };
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue