2023-06-04 04:28:07 +02:00
|
|
|
const { WorkspaceChats } = require("../../../models/workspaceChats");
|
|
|
|
|
2024-02-09 03:37:22 +01: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-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,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2023-06-08 06:31:35 +02:00
|
|
|
resetMemory,
|
|
|
|
};
|