Skip to content

Commit 080306d

Browse files
committed
Better error handling
1 parent 08aa004 commit 080306d

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

interpreter/core/core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ def chat(self, message=None, display=True, stream=False, blocking=True):
187187
self.responding = False
188188
return self.messages[self.last_messages_count :]
189189

190+
except GeneratorExit:
191+
self.responding = False
192+
# It's fine
190193
except Exception as e:
191194
self.responding = False
192195
if self.anonymous_telemetry:

interpreter/core/respond.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ def respond(interpreter):
255255
"content": None,
256256
}
257257

258+
except KeyboardInterrupt:
259+
break # It's fine.
258260
except:
259261
yield {
260262
"role": "computer",

0 commit comments

Comments
 (0)