mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
feat: regenerate for bingai
This commit is contained in:
parent
0891566d1e
commit
66ad54168a
2 changed files with 18 additions and 7 deletions
|
|
@ -9,6 +9,7 @@ router.post('/', async (req, res) => {
|
|||
const {
|
||||
model,
|
||||
text,
|
||||
overrideParentMessageId=null,
|
||||
parentMessageId,
|
||||
conversationId: oldConversationId,
|
||||
...convo
|
||||
|
|
@ -37,8 +38,10 @@ router.post('/', async (req, res) => {
|
|||
...convo
|
||||
});
|
||||
|
||||
await saveMessage(userMessage);
|
||||
await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
|
||||
if (!overrideParentMessageId) {
|
||||
await saveMessage(userMessage);
|
||||
await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
|
||||
}
|
||||
|
||||
return await ask({
|
||||
isNewConversation,
|
||||
|
|
@ -46,6 +49,7 @@ router.post('/', async (req, res) => {
|
|||
model,
|
||||
convo,
|
||||
preSendRequest: true,
|
||||
overrideParentMessageId,
|
||||
req,
|
||||
res
|
||||
});
|
||||
|
|
@ -101,7 +105,8 @@ const ask = async ({
|
|||
convo.conversationSignature || response.conversationSignature;
|
||||
userMessage.conversationId = response.conversationId || conversationId;
|
||||
userMessage.invocationId = response.invocationId;
|
||||
await saveMessage(userMessage);
|
||||
if (!overrideParentMessageId)
|
||||
await saveMessage(userMessage);
|
||||
|
||||
// Bing API will not use our conversationId at the first time,
|
||||
// so change the placeholder conversationId to the real one.
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ router.post('/', async (req, res) => {
|
|||
const {
|
||||
model,
|
||||
text,
|
||||
overrideParentMessageId=null,
|
||||
parentMessageId,
|
||||
conversationId: oldConversationId,
|
||||
...convo
|
||||
|
|
@ -37,8 +38,10 @@ router.post('/', async (req, res) => {
|
|||
...convo
|
||||
});
|
||||
|
||||
await saveMessage(userMessage);
|
||||
await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
|
||||
if (!overrideParentMessageId) {
|
||||
await saveMessage(userMessage);
|
||||
await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
|
||||
}
|
||||
|
||||
return await ask({
|
||||
isNewConversation,
|
||||
|
|
@ -46,6 +49,7 @@ router.post('/', async (req, res) => {
|
|||
model,
|
||||
convo,
|
||||
preSendRequest: true,
|
||||
overrideParentMessageId,
|
||||
req,
|
||||
res
|
||||
});
|
||||
|
|
@ -102,7 +106,8 @@ const ask = async ({
|
|||
userMessage.conversationId = response.conversationId || conversationId;
|
||||
userMessage.invocationId = response.invocationId;
|
||||
// Unlike gpt and bing, Sydney will never accept our given userMessage.messageId, it will generate its own one.
|
||||
await saveMessage(userMessage);
|
||||
if (!overrideParentMessageId)
|
||||
await saveMessage(userMessage);
|
||||
|
||||
// Save sydney response
|
||||
// response.id = response.messageId;
|
||||
|
|
@ -125,7 +130,8 @@ const ask = async ({
|
|||
|
||||
// Save user message
|
||||
userMessage.conversationId = response.conversationId || conversationId;
|
||||
await saveMessage(userMessage);
|
||||
if (!overrideParentMessageId)
|
||||
await saveMessage(userMessage);
|
||||
|
||||
// Bing API will not use our conversationId at the first time,
|
||||
// so change the placeholder conversationId to the real one.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue