anything-llm/server/utils/chats/commands/reset.js
Timothy Carambat 406732830f
Implement workspace threading that is backwards compatible (#699)
* Implement workspace thread that is compatible with legacy versions

* last touches

* comment on chat qty enforcement
2024-02-08 18:37:22 -08:00

32 lines
666 B
JavaScript

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);
return {
uuid: msgUUID,
type: "textResponse",
textResponse: "Workspace chat memory was reset!",
sources: [],
close: true,
error: false,
};
}
module.exports = {
resetMemory,
};