Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

fix: clearConvo will remove all messages

Wentao Lyud8ccc5b870d9
diff --git a/api/models/Conversation.js b/api/models/Conversation.js
index b5716add01..512010c6ba 100644
--- a/api/models/Conversation.js
+++ b/api/models/Conversation.js
@@ -45,13 +45,9 @@ module.exports = {
},
updateConvo: async (user, { conversationId, ...update }) => {
try {
- return await Conversation.findOneAndUpdate(
- { conversationId: conversationId, user },
- update,
- {
- new: true
- }
- ).exec();
+ return await Conversation.findOneAndUpdate({ conversationId: conversationId, user }, update, {
+ new: true
+ }).exec();
} catch (error) {
console.log(error);
return { message: 'Error updating conversation' };
@@ -89,7 +85,7 @@ module.exports = {
promises.push(
Conversation.findOne({
user,
- conversationId: convo.conversationId,
+ conversationId: convo.conversationId
}).exec()
)
);
@@ -143,13 +139,13 @@ module.exports = {
}
} catch (error) {
console.log(error);
- return 'Error getting conversation title';
+ return { message: 'Error getting conversation title' };
}
},
deleteConvos: async (user, filter) => {
let deleteCount = await Conversation.deleteMany({ ...filter, user }).exec();
console.log('deleteCount', deleteCount);
- deleteCount.messages = await deleteMessages(filter);
+ deleteCount.messages = await deleteMessages({ ...filter, user });
return deleteCount;
}
};