mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
sync updates and merge with feat-resubmit
This commit is contained in:
parent
62d88380e0
commit
b0284b6974
5 changed files with 46 additions and 32 deletions
|
|
@ -38,7 +38,7 @@ router.post('/', async (req, res) => {
|
|||
});
|
||||
|
||||
await saveMessage(userMessage);
|
||||
await saveConvo({ ...userMessage, model, ...convo });
|
||||
await saveConvo(req?.session?.user?.username, { ...userMessage, model, ...convo });
|
||||
|
||||
return await ask({
|
||||
isNewConversation,
|
||||
|
|
@ -132,10 +132,13 @@ const ask = async ({
|
|||
// Attition: the api will also create new conversationId while using invalid userMessage.parentMessageId,
|
||||
// but in this situation, don't change the conversationId, but create new convo.
|
||||
if (conversationId != userMessage.conversationId && isNewConversation)
|
||||
await saveConvo({
|
||||
conversationId: conversationId,
|
||||
newConversationId: userMessage.conversationId
|
||||
});
|
||||
await saveConvo(
|
||||
req?.session?.user?.username,
|
||||
{
|
||||
conversationId: conversationId,
|
||||
newConversationId: userMessage.conversationId
|
||||
}
|
||||
);
|
||||
conversationId = userMessage.conversationId;
|
||||
|
||||
response.text = await handleText(response, true);
|
||||
|
|
@ -144,7 +147,7 @@ const ask = async ({
|
|||
await saveConvo(req?.session?.user?.username, { ...response, model, chatGptLabel: null, promptPrefix: null, ...convo });
|
||||
|
||||
sendMessage(res, {
|
||||
title: await getConvoTitle(conversationId),
|
||||
title: await getConvoTitle(req?.session?.user?.username, conversationId),
|
||||
final: true,
|
||||
requestMessage: userMessage,
|
||||
responseMessage: response
|
||||
|
|
@ -154,10 +157,13 @@ const ask = async ({
|
|||
if (userParentMessageId == '00000000-0000-0000-0000-000000000000') {
|
||||
const title = await titleConvo({ model, text, response });
|
||||
|
||||
await saveConvo({
|
||||
conversationId,
|
||||
title
|
||||
});
|
||||
await saveConvo(
|
||||
req?.session?.user?.username,
|
||||
{
|
||||
conversationId,
|
||||
title
|
||||
}
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue