Clear chat window on /reset (#1261)

clear chat window on /reset
This commit is contained in:
Timothy Carambat 2024-05-01 20:39:58 -07:00 committed by GitHub
parent 9feaad79cc
commit 47b7df4fc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -17,6 +17,7 @@ export default function handleChat(
error,
close,
chatId = null,
action = null,
} = chatResult;
if (type === "abort" || type === "statusResponse") {
@ -132,6 +133,12 @@ export default function handleChat(
setChatHistory([..._chatHistory]);
setLoadingResponse(false);
}
// Action Handling via special 'action' attribute on response.
if (action === "reset_chat") {
// Chat was reset, keep reset message and clear everything else.
setChatHistory([_chatHistory.pop()]);
}
}
export function chatPrompt(workspace) {

View File

@ -23,6 +23,7 @@ async function resetMemory(
sources: [],
close: true,
error: false,
action: "reset_chat",
};
}