From e0aaad8f477386345a14c9adc7a7721fda115faa Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Mon, 1 Jan 2024 23:20:48 +0100 Subject: Fix permissions for chromedriver Fix NoVNC server access Remove java from build --- g4f/__init__.py | 2 +- g4f/gui/server/backend.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'g4f') diff --git a/g4f/__init__.py b/g4f/__init__.py index 57151376..699dc238 100644 --- a/g4f/__init__.py +++ b/g4f/__init__.py @@ -128,7 +128,7 @@ class Completion: return result if stream else ''.join(result) -def get_last_provider(as_dict: bool = False) -> ProviderType: +def get_last_provider(as_dict: bool = False) -> Union[ProviderType, dict[str, str]]: last = debug.last_provider if isinstance(last, BaseRetryProvider): last = last.last_provider diff --git a/g4f/gui/server/backend.py b/g4f/gui/server/backend.py index 1aa506b2..595f5aa1 100644 --- a/g4f/gui/server/backend.py +++ b/g4f/gui/server/backend.py @@ -1,3 +1,4 @@ +import logging import g4f from g4f.Provider import __providers__ @@ -94,10 +95,10 @@ class Backend_Api: }) + "\n" except Exception as e: + logging.exception(e) yield json.dumps({ 'type' : 'error', 'error': f'{e.__class__.__name__}: {e}' }) - raise e return self.app.response_class(try_response(), mimetype='text/event-stream') \ No newline at end of file -- cgit v1.2.3