mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-28 14:18:51 +01:00
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
export default function createPayload(submission) {
|
|
const { conversation, messages, message, initialResponse, isRegenerate = false } = submission;
|
|
|
|
const endpoint = `/api/ask`;
|
|
const {
|
|
model,
|
|
chatGptLabel,
|
|
promptPrefix,
|
|
jailbreakConversationId,
|
|
conversationId,
|
|
conversationSignature,
|
|
clientId,
|
|
invocationId,
|
|
toneStyle
|
|
} = conversation;
|
|
|
|
let payload = {
|
|
...message,
|
|
...{
|
|
model,
|
|
chatGptLabel,
|
|
promptPrefix,
|
|
conversationId
|
|
}
|
|
};
|
|
|
|
// 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 && !conversationId) {
|
|
payload.toneStyle = toneStyle || 'fast';
|
|
}
|
|
|
|
if (isBing && conversationId) {
|
|
payload = {
|
|
...payload,
|
|
jailbreakConversationId,
|
|
conversationSignature,
|
|
clientId,
|
|
invocationId
|
|
};
|
|
}
|
|
|
|
let server = endpoint;
|
|
server = model === 'bingai' ? server + '/bing' : server;
|
|
server = model === 'sydney' ? server + '/sydney' : server;
|
|
return { server, payload };
|
|
}
|