mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
fix: dont send gen_title twice
This commit is contained in:
parent
d73375958b
commit
8b00805d24
5 changed files with 29 additions and 18 deletions
|
|
@ -167,6 +167,8 @@ router.post('/', async (req, res) => {
|
||||||
response: JSON.stringify(gptResponse?.text)
|
response: JSON.stringify(gptResponse?.text)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('CONVERSATION TITLE', title);
|
||||||
|
|
||||||
await saveConvo({
|
await saveConvo({
|
||||||
conversationId,
|
conversationId,
|
||||||
title
|
title
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,8 @@ router.post('/', async (req, res) => {
|
||||||
response: JSON.stringify(gptResponse?.text)
|
response: JSON.stringify(gptResponse?.text)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('CONVERSATION TITLE', title);
|
||||||
|
|
||||||
await saveConvo({
|
await saveConvo({
|
||||||
conversationId,
|
conversationId,
|
||||||
title
|
title
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,8 @@ router.post('/', async (req, res) => {
|
||||||
response: JSON.stringify(gptResponse?.text)
|
response: JSON.stringify(gptResponse?.text)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('CONVERSATION TITLE', title);
|
||||||
|
|
||||||
await saveConvo({
|
await saveConvo({
|
||||||
conversationId,
|
conversationId,
|
||||||
title
|
title
|
||||||
|
|
|
||||||
|
|
@ -17,20 +17,23 @@ router.post('/gen_title', async (req, res) => {
|
||||||
const firstMessage = (await getMessages({ conversationId }))[0]
|
const firstMessage = (await getMessages({ conversationId }))[0]
|
||||||
const secondMessage = (await getMessages({ conversationId }))[1]
|
const secondMessage = (await getMessages({ conversationId }))[1]
|
||||||
|
|
||||||
const title = convo.jailbreakConversationId
|
// if (convo.title == 'New Chat') {
|
||||||
? await getConvoTitle(conversationId)
|
// const title = await titleConvo({
|
||||||
: await titleConvo({
|
// model: convo?.model,
|
||||||
model: convo?.model,
|
// message: firstMessage?.text,
|
||||||
message: firstMessage?.text,
|
// response: JSON.stringify(secondMessage?.text || '')
|
||||||
response: JSON.stringify(secondMessage?.text || '')
|
// });
|
||||||
});
|
|
||||||
|
|
||||||
await saveConvo({
|
// console.log('CONVERSATION TITLE', title);
|
||||||
conversationId,
|
|
||||||
title
|
|
||||||
})
|
|
||||||
|
|
||||||
res.status(200).send(title);
|
// await saveConvo({
|
||||||
|
// conversationId,
|
||||||
|
// title
|
||||||
|
// })
|
||||||
|
|
||||||
|
// res.status(200).send(title);
|
||||||
|
// } else
|
||||||
|
return res.status(200).send(convo.title);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/clear', async (req, res) => {
|
router.post('/clear', async (req, res) => {
|
||||||
|
|
|
||||||
|
|
@ -60,12 +60,14 @@ export default function TextChat({ messages }) {
|
||||||
const isBing = model === 'bingai' || model === 'sydney';
|
const isBing = model === 'bingai' || model === 'sydney';
|
||||||
|
|
||||||
if (requestMessage.parentMessageId == '00000000-0000-0000-0000-000000000000') {
|
if (requestMessage.parentMessageId == '00000000-0000-0000-0000-000000000000') {
|
||||||
genTitle.trigger({ conversationId }).then((ret) => {
|
setTimeout(() => {
|
||||||
const title = ret?.data
|
dispatch(refreshConversation());
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
if (title)
|
// in case it takes too long.
|
||||||
|
setTimeout(() => {
|
||||||
dispatch(refreshConversation());
|
dispatch(refreshConversation());
|
||||||
})
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isBing && convo.conversationId === null && convo.parentMessageId === null) {
|
if (!isBing && convo.conversationId === null && convo.parentMessageId === null) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue