Skip to content

Commit f11f1e2

Browse files
authored
Merge pull request #1095 from MikeBirdTech/fix-reset
Clear messages on %reset instead of instantiating a new Interpreter
2 parents 6d12384 + cbf8416 commit f11f1e2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

docs/usage/terminal/magic-commands.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ title: Magic Commands
44

55
Magic commands can be used to control the interpreter's behavior in interactive mode:
66

7-
- `%% [commands]`: Run commands in system shell
7+
- `%% [commands]`: Run commands in system shell.
88
- `%verbose [true/false]`: Toggle verbose mode. Without arguments or with 'true', it enters verbose mode. With 'false', it exits verbose mode.
9-
- `%reset`: Reset the current session
9+
- `%reset`: Resets the current session's conversation.
1010
- `%undo`: Remove previous messages and its response from the message history.
1111
- `%save_message [path]`: Saves messages to a specified JSON path. If no path is provided, it defaults to 'messages.json'.
1212
- `%load_message [path]`: Loads messages from a specified JSON path. If no path is provided, it defaults to 'messages.json'.

interpreter/core/core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ def is_active_line_chunk(chunk):
352352

353353
def reset(self):
354354
self.computer.terminate() # Terminates all languages
355-
self.__init__()
355+
self.messages = []
356+
self.last_messages_count = 0
356357

357358
def display_message(self, markdown):
358359
# This is just handy for start_script in profiles.

0 commit comments

Comments
 (0)