summaryrefslogtreecommitdiffstats
path: root/g4f
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-03-22 13:01:48 +0100
committerGitHub <noreply@github.com>2024-03-22 13:01:48 +0100
commitcb74a39d9272801e5d264574fc16fce8ac89011d (patch)
tree81c2e2a16703797153f398953f757ef531c283ff /g4f
parentMerge pull request #1729 from hlohaus/giga (diff)
parentAdd updated requirements (diff)
downloadgpt4free-cb74a39d9272801e5d264574fc16fce8ac89011d.tar
gpt4free-cb74a39d9272801e5d264574fc16fce8ac89011d.tar.gz
gpt4free-cb74a39d9272801e5d264574fc16fce8ac89011d.tar.bz2
gpt4free-cb74a39d9272801e5d264574fc16fce8ac89011d.tar.lz
gpt4free-cb74a39d9272801e5d264574fc16fce8ac89011d.tar.xz
gpt4free-cb74a39d9272801e5d264574fc16fce8ac89011d.tar.zst
gpt4free-cb74a39d9272801e5d264574fc16fce8ac89011d.zip
Diffstat (limited to 'g4f')
-rw-r--r--g4f/Provider/Bing.py2
-rw-r--r--g4f/gui/client/static/js/chat.v1.js16
-rw-r--r--g4f/gui/server/api.py8
-rw-r--r--g4f/gui/webview.py3
4 files changed, 15 insertions, 14 deletions
diff --git a/g4f/Provider/Bing.py b/g4f/Provider/Bing.py
index a1d14d87..f8b06dd1 100644
--- a/g4f/Provider/Bing.py
+++ b/g4f/Provider/Bing.py
@@ -414,7 +414,7 @@ async def stream_generate(
image_request = await upload_image(
session,
image,
- "Balanced" if Tones.copilot == "Copilot" else tone,
+ "Balanced" if tone == Tones.copilot else tone,
headers
) if image else None
async with session.ws_connect(
diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js
index bcef4a78..f9bc4568 100644
--- a/g4f/gui/client/static/js/chat.v1.js
+++ b/g4f/gui/client/static/js/chat.v1.js
@@ -240,26 +240,26 @@ async function add_message_chunk(message) {
}
}
-cameraInput?.addEventListener("click", (e) => {
- if (window?.pywebview) {
- e.preventDefault();
- pywebview.api.choose_file();
- }
-})
+// fileInput?.addEventListener("click", (e) => {
+// if (window?.pywebview) {
+// e.preventDefault();
+// pywebview.api.choose_file();
+// }
+// });
cameraInput?.addEventListener("click", (e) => {
if (window?.pywebview) {
e.preventDefault();
pywebview.api.take_picture();
}
-})
+});
imageInput?.addEventListener("click", (e) => {
if (window?.pywebview) {
e.preventDefault();
pywebview.api.choose_image();
}
-})
+});
const ask_gpt = async () => {
regenerate.classList.add(`regenerate-hidden`);
diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py
index 3adb88f4..e7683812 100644
--- a/g4f/gui/server/api.py
+++ b/g4f/gui/server/api.py
@@ -19,12 +19,12 @@ try:
filters=[["Image", "*.jpg", "*.jpeg", "*.png", "*.webp", "*.svg"]],
)
has_plyer = True
-except (ImportError, NameError):
+except ImportError:
has_plyer = False
try:
from android.runnable import run_on_ui_thread
- from android.storage import app_storage_path
- from android.permissions import request_permissions, Permission
+ import android.permissions
+ from android.permissions import Permission
from android.permissions import _RequestPermissionsManager
_RequestPermissionsManager.register_callback()
from .android_gallery import user_select_image
@@ -161,7 +161,7 @@ class Api():
def request_permissions(self):
if has_android:
- request_permissions([
+ android.permissions.request_permissions([
Permission.CAMERA,
Permission.READ_EXTERNAL_STORAGE,
Permission.WRITE_EXTERNAL_STORAGE
diff --git a/g4f/gui/webview.py b/g4f/gui/webview.py
index 36ad0e60..b015dbed 100644
--- a/g4f/gui/webview.py
+++ b/g4f/gui/webview.py
@@ -16,6 +16,7 @@ import g4f.debug
def run_webview(
debug: bool = False,
+ ssl: bool = True,
storage_path: str = None
):
if getattr(sys, 'frozen', False):
@@ -36,7 +37,7 @@ def run_webview(
private_mode=False,
storage_path=storage_path,
debug=debug,
- ssl=True
+ ssl=ssl
)
if __name__ == "__main__":