summaryrefslogtreecommitdiffstats
path: root/g4f/gui/server/api.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-04-07 10:36:13 +0200
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-04-07 10:36:13 +0200
commitb35dfcd1b01c575b65e0299ef71d285dc8f41459 (patch)
treecfe5f4a390af62fafefd1d27ca2c82a23cdcab49 /g4f/gui/server/api.py
parentUpdate Gemini.py (diff)
downloadgpt4free-b35dfcd1b01c575b65e0299ef71d285dc8f41459.tar
gpt4free-b35dfcd1b01c575b65e0299ef71d285dc8f41459.tar.gz
gpt4free-b35dfcd1b01c575b65e0299ef71d285dc8f41459.tar.bz2
gpt4free-b35dfcd1b01c575b65e0299ef71d285dc8f41459.tar.lz
gpt4free-b35dfcd1b01c575b65e0299ef71d285dc8f41459.tar.xz
gpt4free-b35dfcd1b01c575b65e0299ef71d285dc8f41459.tar.zst
gpt4free-b35dfcd1b01c575b65e0299ef71d285dc8f41459.zip
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