2023-06-03 19:28:07 -07:00
|
|
|
const { WorkspaceChats } = require("../../../models/workspaceChats");
|
|
|
|
|
2024-02-08 18:37:22 -08:00
|
|
|
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-03 19:28:07 -07:00
|
|
|
return {
|
|
|
|
uuid: msgUUID,
|
2023-06-07 21:31:35 -07:00
|
|
|
type: "textResponse",
|
|
|
|
textResponse: "Workspace chat memory was reset!",
|
2023-06-03 19:28:07 -07:00
|
|
|
sources: [],
|
|
|
|
close: true,
|
|
|
|
error: false,
|
2024-05-01 20:39:58 -07:00
|
|
|
action: "reset_chat",
|
2023-06-03 19:28:07 -07:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2023-06-07 21:31:35 -07:00
|
|
|
resetMemory,
|
|
|
|
};
|