diff --git a/frontend/src/utils/chat/index.js b/frontend/src/utils/chat/index.js index a2b18c7f..c5730dbe 100644 --- a/frontend/src/utils/chat/index.js +++ b/frontend/src/utils/chat/index.js @@ -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) { diff --git a/server/utils/chats/commands/reset.js b/server/utils/chats/commands/reset.js index a23eef7a..f2bd4562 100644 --- a/server/utils/chats/commands/reset.js +++ b/server/utils/chats/commands/reset.js @@ -23,6 +23,7 @@ async function resetMemory( sources: [], close: true, error: false, + action: "reset_chat", }; }