Skip to content

Commit 1eab826

Browse files
committed
fix: clear chat command properly resets things
1 parent d99ba53 commit 1eab826

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/components/UserInput.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ export const UserInput: React.FC = () => {
2020
}
2121

2222
if (value.toLowerCase() === commands.CLEAR) {
23-
console.clear()
24-
actions.setInput("")
25-
reset()
23+
actions.reset()
2624
return
2725
}
2826

src/store.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export interface StoreModel {
8080
appendCurrentAssistantMessage: Action<StoreModel, string>
8181
clearCurrentAssistantMessage: Action<StoreModel>
8282
clearToolUses: Action<StoreModel>
83+
reset: Action<StoreModel>
8384
sendMessage: Action<StoreModel, string>
8485
setPendingToolPermission: Action<
8586
StoreModel,
@@ -176,6 +177,14 @@ export const AgentStore = createContextStore<StoreModel>({
176177
state.currentToolUses = []
177178
}),
178179

180+
reset: action((state) => {
181+
state.chatHistory = []
182+
state.currentAssistantMessage = ""
183+
state.currentToolUses = []
184+
state.input = ""
185+
state.stats = null
186+
}),
187+
179188
setConfig: action((state, payload) => {
180189
state.config = payload
181190
}),

0 commit comments

Comments
 (0)