summaryrefslogtreecommitdiffstats
path: root/g4f/gui/server/api.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-04-09 19:40:42 +0200
committerGitHub <noreply@github.com>2024-04-09 19:40:42 +0200
commit4c23b4cad4744e20da7ccffb303503ea627df7c2 (patch)
treea032e6ebd494136ba35e049b06aa4af45558b540 /g4f/gui/server/api.py
parentMerge pull request #1809 from ochen1/patch-1 (diff)
parentAdd project files (diff)
downloadgpt4free-4c23b4cad4744e20da7ccffb303503ea627df7c2.tar
gpt4free-4c23b4cad4744e20da7ccffb303503ea627df7c2.tar.gz
gpt4free-4c23b4cad4744e20da7ccffb303503ea627df7c2.tar.bz2
gpt4free-4c23b4cad4744e20da7ccffb303503ea627df7c2.tar.lz
gpt4free-4c23b4cad4744e20da7ccffb303503ea627df7c2.tar.xz
gpt4free-4c23b4cad4744e20da7ccffb303503ea627df7c2.tar.zst
gpt4free-4c23b4cad4744e20da7ccffb303503ea627df7c2.zip
Diffstat (limited to 'g4f/gui/server/api.py')
-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,