From c7307030a9d3c6d9db0300573f358e3e203bb693 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 10 Dec 2023 22:10:56 +0100 Subject: Improve error handling in gui --- g4f/gui/server/backend.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'g4f/gui/server') diff --git a/g4f/gui/server/backend.py b/g4f/gui/server/backend.py index d17e21b7..9dc5dbb4 100644 --- a/g4f/gui/server/backend.py +++ b/g4f/gui/server/backend.py @@ -74,14 +74,14 @@ class Backend_Api: provider = g4f.Provider.ProviderUtils.convert.get(provider) def try_response(): - response = g4f.ChatCompletion.create( - model=model, - provider=provider, - messages=messages, - stream=True, - ignore_stream_and_auth=True - ) try: + response = g4f.ChatCompletion.create( + model=model, + provider=provider, + messages=messages, + stream=True, + ignore_stream_and_auth=True + ) yield from response except Exception as e: print(e) -- cgit v1.2.3