yield from

This commit is contained in:
Paul Gauthier 2024-04-27 11:47:18 -07:00
parent c32666b1c5
commit 296a336d22

View file

@ -409,8 +409,7 @@ class Coder:
def run_stream(self, user_message): def run_stream(self, user_message):
self.io.user_input(user_message) self.io.user_input(user_message)
self.reflected_message = None self.reflected_message = None
for chunk in self.send_new_user_message(user_message): yield from self.send_new_user_message(user_message)
yield chunk
def run(self, with_message=None): def run(self, with_message=None):
while True: while True:
@ -561,8 +560,7 @@ class Coder:
exhausted = False exhausted = False
interrupted = False interrupted = False
try: try:
for chunk in self.send(messages, functions=self.functions): yield from self.send(messages, functions=self.functions)
yield chunk
except KeyboardInterrupt: except KeyboardInterrupt:
interrupted = True interrupted = True
except ExhaustedContextWindow: except ExhaustedContextWindow:
@ -688,8 +686,7 @@ class Coder:
self.chat_completion_call_hashes.append(hash_object.hexdigest()) self.chat_completion_call_hashes.append(hash_object.hexdigest())
if self.stream: if self.stream:
for chunk in self.show_send_output_stream(completion): yield from self.show_send_output_stream(completion)
yield chunk
else: else:
self.show_send_output(completion) self.show_send_output(completion)
except KeyboardInterrupt: except KeyboardInterrupt: