summaryrefslogtreecommitdiffstats
path: root/g4f/gui/server/api.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--g4f/gui/server/api.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py
index 7c09fdbe..2b3f2fb6 100644
--- a/g4f/gui/server/api.py
+++ b/g4f/gui/server/api.py
@@ -80,13 +80,12 @@ class Api():
Returns:
dict: Arguments prepared for chat completion.
"""
- provider = json_data.get('provider', None)
- if "image" in kwargs and provider is None:
- provider = "Bing"
- if provider == 'OpenaiChat':
- kwargs['auto_continue'] = True
-
+ model = json_data.get('model') or models.default
+ provider = json_data.get('provider')
messages = json_data['messages']
+ api_key = json_data.get("api_key")
+ if api_key is not None:
+ kwargs["api_key"] = api_key
if json_data.get('web_search'):
if provider == "Bing":
kwargs['web_search'] = True
@@ -98,8 +97,6 @@ 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') or models.default
-
return {
"model": model,
"provider": provider,