mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50: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 {
|
const {
|
||||||
model,
|
model,
|
||||||
text,
|
text,
|
||||||
|
overrideParentMessageId=null,
|
||||||
parentMessageId,
|
parentMessageId,
|
||||||
conversationId: oldConversationId,
|
conversationId: oldConversationId,
|
||||||
...convo
|
...convo
|
||||||
|
|
@ -37,8 +38,10 @@ router.post('/', async (req, res) => {
|
||||||
...convo
|
...convo
|
||||||
});
|
});
|
||||||
|
|
||||||
await saveMessage(userMessage);
|
if (!overrideParentMessageId) {
|
||||||
await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
|
await saveMessage(userMessage);
|
||||||
|
await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
|
||||||
|
}
|
||||||
|
|
||||||
return await ask({
|
return await ask({
|
||||||
isNewConversation,
|
isNewConversation,
|
||||||
|
|
@ -46,6 +49,7 @@ router.post('/', async (req, res) => {
|
||||||
model,
|
model,
|
||||||
convo,
|
convo,
|
||||||
preSendRequest: true,
|
preSendRequest: true,
|
||||||
|
overrideParentMessageId,
|
||||||
req,
|
req,
|
||||||
res
|
res
|
||||||
});
|
});
|
||||||
|
|
@ -101,7 +105,8 @@ const ask = async ({
|
||||||
convo.conversationSignature || response.conversationSignature;
|
convo.conversationSignature || response.conversationSignature;
|
||||||
userMessage.conversationId = response.conversationId || conversationId;
|
userMessage.conversationId = response.conversationId || conversationId;
|
||||||
userMessage.invocationId = response.invocationId;
|
userMessage.invocationId = response.invocationId;
|
||||||
await saveMessage(userMessage);
|
if (!overrideParentMessageId)
|
||||||
|
await saveMessage(userMessage);
|
||||||
|
|
||||||
// Bing API will not use our conversationId at the first time,
|
// Bing API will not use our conversationId at the first time,
|
||||||
// so change the placeholder conversationId to the real one.
|
// so change the placeholder conversationId to the real one.
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ router.post('/', async (req, res) => {
|
||||||
const {
|
const {
|
||||||
model,
|
model,
|
||||||
text,
|
text,
|
||||||
|
overrideParentMessageId=null,
|
||||||
parentMessageId,
|
parentMessageId,
|
||||||
conversationId: oldConversationId,
|
conversationId: oldConversationId,
|
||||||
...convo
|
...convo
|
||||||
|
|
@ -37,8 +38,10 @@ router.post('/', async (req, res) => {
|
||||||
...convo
|
...convo
|
||||||
});
|
});
|
||||||
|
|
||||||
await saveMessage(userMessage);
|
if (!overrideParentMessageId) {
|
||||||
await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
|
await saveMessage(userMessage);
|
||||||
|
await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
|
||||||
|
}
|
||||||
|
|
||||||
return await ask({
|
return await ask({
|
||||||
isNewConversation,
|
isNewConversation,
|
||||||
|
|
@ -46,6 +49,7 @@ router.post('/', async (req, res) => {
|
||||||
model,
|
model,
|
||||||
convo,
|
convo,
|
||||||
preSendRequest: true,
|
preSendRequest: true,
|
||||||
|
overrideParentMessageId,
|
||||||
req,
|
req,
|
||||||
res
|
res
|
||||||
});
|
});
|
||||||
|
|
@ -102,7 +106,8 @@ const ask = async ({
|
||||||
userMessage.conversationId = response.conversationId || conversationId;
|
userMessage.conversationId = response.conversationId || conversationId;
|
||||||
userMessage.invocationId = response.invocationId;
|
userMessage.invocationId = response.invocationId;
|
||||||
// Unlike gpt and bing, Sydney will never accept our given userMessage.messageId, it will generate its own one.
|
// 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
|
// Save sydney response
|
||||||
// response.id = response.messageId;
|
// response.id = response.messageId;
|
||||||
|
|
@ -125,7 +130,8 @@ const ask = async ({
|
||||||
|
|
||||||
// Save user message
|
// Save user message
|
||||||
userMessage.conversationId = response.conversationId || conversationId;
|
userMessage.conversationId = response.conversationId || conversationId;
|
||||||
await saveMessage(userMessage);
|
if (!overrideParentMessageId)
|
||||||
|
await saveMessage(userMessage);
|
||||||
|
|
||||||
// Bing API will not use our conversationId at the first time,
|
// Bing API will not use our conversationId at the first time,
|
||||||
// so change the placeholder conversationId to the real one.
|
// so change the placeholder conversationId to the real one.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue