fix GeneratorExit
This commit is contained in:
parent
20047fa0e4
commit
1e68e10b62
|
@ -151,7 +151,9 @@ def openai_chat_completions(model_name=None):
|
||||||
handler.backend_url,
|
handler.backend_url,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
except (Exception, GeneratorExit):
|
except GeneratorExit:
|
||||||
|
return
|
||||||
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
yield 'data: [DONE]\n\n'
|
yield 'data: [DONE]\n\n'
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -197,7 +197,10 @@ def openai_completions(model_name=None):
|
||||||
handler.backend_url,
|
handler.backend_url,
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
except (Exception, GeneratorExit):
|
except GeneratorExit:
|
||||||
|
# This should be triggered if a client disconnects early.
|
||||||
|
return
|
||||||
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
yield 'data: [DONE]\n\n'
|
yield 'data: [DONE]\n\n'
|
||||||
finally:
|
finally:
|
||||||
|
|
Reference in New Issue