fix GeneratorExit

This commit is contained in:
Cyberes 2023-10-16 18:04:49 -06:00
parent 20047fa0e4
commit 1e68e10b62
2 changed files with 7 additions and 2 deletions

View File

@ -151,7 +151,9 @@ def openai_chat_completions(model_name=None):
handler.backend_url,
)
return
except (Exception, GeneratorExit):
except GeneratorExit:
return
except Exception:
traceback.print_exc()
yield 'data: [DONE]\n\n'
finally:

View File

@ -197,7 +197,10 @@ def openai_completions(model_name=None):
handler.backend_url,
)
return
except (Exception, GeneratorExit):
except GeneratorExit:
# This should be triggered if a client disconnects early.
return
except Exception:
traceback.print_exc()
yield 'data: [DONE]\n\n'
finally: