Skip to content
Snippets Groups Projects
Unverified Commit 47b7df4f authored by Timothy Carambat's avatar Timothy Carambat Committed by GitHub
Browse files

Clear chat window on `/reset` (#1261)

clear chat window on /reset
parent 9feaad79
No related branches found
No related tags found
No related merge requests found
...@@ -17,6 +17,7 @@ export default function handleChat( ...@@ -17,6 +17,7 @@ export default function handleChat(
error, error,
close, close,
chatId = null, chatId = null,
action = null,
} = chatResult; } = chatResult;
if (type === "abort" || type === "statusResponse") { if (type === "abort" || type === "statusResponse") {
...@@ -132,6 +133,12 @@ export default function handleChat( ...@@ -132,6 +133,12 @@ export default function handleChat(
setChatHistory([..._chatHistory]); setChatHistory([..._chatHistory]);
setLoadingResponse(false); 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) { export function chatPrompt(workspace) {
......
...@@ -23,6 +23,7 @@ async function resetMemory( ...@@ -23,6 +23,7 @@ async function resetMemory(
sources: [], sources: [],
close: true, close: true,
error: false, error: false,
action: "reset_chat",
}; };
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment