summaryrefslogtreecommitdiffstats
path: root/g4f/gui/server/backend.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-03 16:02:06 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-03 16:02:06 +0100
commit25895eb63799a1c38a40f03a48e85cdd8e9dc4b9 (patch)
tree2e1a35054f01c91298993c777b7756cdd9d7bae9 /g4f/gui/server/backend.py
parentNew Provider 'Bestim' (#1416) (diff)
downloadgpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar.gz
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar.bz2
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar.lz
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar.xz
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.tar.zst
gpt4free-25895eb63799a1c38a40f03a48e85cdd8e9dc4b9.zip
Diffstat (limited to '')
-rw-r--r--g4f/gui/server/backend.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/g4f/gui/server/backend.py b/g4f/gui/server/backend.py
index 595f5aa1..00f2a827 100644
--- a/g4f/gui/server/backend.py
+++ b/g4f/gui/server/backend.py
@@ -6,9 +6,14 @@ import json
from flask import request, Flask
from .internet import get_search_message
from g4f import debug, version
-
+from g4f.base_provider import ProviderType
debug.logging = True
+def patch_provider(provider: ProviderType):
+ from g4f.Provider import CreateImagesProvider
+ from g4f.Provider.bing.create_images import create_completion
+ return CreateImagesProvider(provider, create_completion)
+
class Backend_Api:
def __init__(self, app: Flask) -> None:
self.app: Flask = app
@@ -72,7 +77,8 @@ class Backend_Api:
model = model if model else g4f.models.default
provider = request.json.get('provider', '').replace('g4f.Provider.', '')
provider = provider if provider and provider != "Auto" else None
-
+ patch = patch_provider if request.json.get('patch_provider') else None
+
def try_response():
try:
first = True
@@ -81,7 +87,8 @@ class Backend_Api:
provider=provider,
messages=messages,
stream=True,
- ignore_stream_and_auth=True
+ ignore_stream_and_auth=True,
+ patch_provider=patch
):
if first:
first = False