mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
fix: failsafe to prevent all convos clearing from delete button
This commit is contained in:
parent
0fbbe74479
commit
4564b648f7
2 changed files with 8 additions and 2 deletions
|
|
@ -41,11 +41,17 @@ router.post('/gen_title', async (req, res) => {
|
|||
|
||||
router.post('/clear', async (req, res) => {
|
||||
let filter = {};
|
||||
const { conversationId } = req.body.arg;
|
||||
const { conversationId, source } = req.body.arg;
|
||||
if (conversationId) {
|
||||
filter = { conversationId };
|
||||
}
|
||||
|
||||
console.log('source:', source);
|
||||
|
||||
if (source === 'button' && !conversationId) {
|
||||
return res.status(200).send('No conversationId provided');
|
||||
}
|
||||
|
||||
try {
|
||||
const dbResponse = await deleteConvos(req?.session?.user?.username, filter);
|
||||
res.status(201).send(dbResponse);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export default function DeleteButton({ conversationId, renaming, cancelHandler,
|
|||
}
|
||||
);
|
||||
|
||||
const clickHandler = () => trigger({ conversationId });
|
||||
const clickHandler = () => trigger({ conversationId, source: 'button' });
|
||||
const handler = renaming ? cancelHandler : clickHandler;
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue