anything-llm/server/utils/chats/commands/reset.js

33 lines
692 B
JavaScript
Raw Normal View History

2023-06-04 04:28:07 +02:00
const { WorkspaceChats } = require("../../../models/workspaceChats");
async function resetMemory(
workspace,
_message,
msgUUID,
user = null,
thread = null
) {
// If thread is present we are wanting to reset this specific thread. Not the whole workspace.
thread
? await WorkspaceChats.markThreadHistoryInvalid(
workspace.id,
user,
thread.id
)
: await WorkspaceChats.markHistoryInvalid(workspace.id, user);
2023-06-04 04:28:07 +02:00
return {
uuid: msgUUID,
2023-06-08 06:31:35 +02:00
type: "textResponse",
textResponse: "Workspace chat memory was reset!",
2023-06-04 04:28:07 +02:00
sources: [],
close: true,
error: false,
action: "reset_chat",
2023-06-04 04:28:07 +02:00
};
}
module.exports = {
2023-06-08 06:31:35 +02:00
resetMemory,
};