summaryrefslogtreecommitdiffstats
path: root/g4f/gui/server/api.py
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/gui/server/api.py')
-rw-r--r--g4f/gui/server/api.py8
1 files changed, 6 insertions, 2 deletions
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