From b35dfcd1b01c575b65e0299ef71d285dc8f41459 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 7 Apr 2024 10:36:13 +0200 Subject: Add local models to gui, Fix You Provider, add AsyncClient --- g4f/gui/server/api.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'g4f/gui/server/api.py') diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py index 2c6279d1..7c09fdbe 100644 --- a/g4f/gui/server/api.py +++ b/g4f/gui/server/api.py @@ -98,7 +98,7 @@ class Api(): if conversation_id and provider in conversations and conversation_id in conversations[provider]: kwargs["conversation"] = conversations[provider][conversation_id] - model = json_data.get('model', models.default) + model = json_data.get('model') or models.default return { "model": model, @@ -169,4 +169,8 @@ def get_error_message(exception: Exception) -> str: Returns: str: A formatted error message string. """ - return f"{get_last_provider().__name__}: {type(exception).__name__}: {exception}" \ No newline at end of file + message = f"{type(exception).__name__}: {exception}" + provider = get_last_provider() + if provider is None: + return message + return f"{provider.__name__}: {message}" \ No newline at end of file -- cgit v1.2.3