From 07c944ad0a90e10e9401d34a626bbc7878ffab2a Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Tue, 23 Jan 2024 01:47:55 +0100 Subject: Add upload svg image support Fix upload image in Bing Provider --- g4f/gui/client/html/index.html | 4 ++-- g4f/gui/client/js/chat.v1.js | 8 +++++++- g4f/gui/server/backend.py | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) (limited to 'g4f/gui') diff --git a/g4f/gui/client/html/index.html b/g4f/gui/client/html/index.html index 95489ba4..5edb55e8 100644 --- a/g4f/gui/client/html/index.html +++ b/g4f/gui/client/html/index.html @@ -115,11 +115,11 @@
diff --git a/g4f/gui/client/js/chat.v1.js b/g4f/gui/client/js/chat.v1.js index 8b9bc181..d62c040b 100644 --- a/g4f/gui/client/js/chat.v1.js +++ b/g4f/gui/client/js/chat.v1.js @@ -660,7 +660,13 @@ observer.observe(message_input, { attributes: true }); } document.getElementById("version_text").innerHTML = text })() - +imageInput.addEventListener('click', async (event) => { + imageInput.value = ''; +}); +fileInput.addEventListener('click', async (event) => { + fileInput.value = ''; + delete fileInput.dataset.text; +}); fileInput.addEventListener('change', async (event) => { if (fileInput.files.length) { type = fileInput.files[0].type; diff --git a/g4f/gui/server/backend.py b/g4f/gui/server/backend.py index d5c59ed1..9346f489 100644 --- a/g4f/gui/server/backend.py +++ b/g4f/gui/server/backend.py @@ -137,7 +137,7 @@ class Backend_Api: if 'image' in request.files: file = request.files['image'] if file.filename != '' and is_allowed_extension(file.filename): - kwargs['image'] = to_image(file.stream) + kwargs['image'] = to_image(file.stream, file.filename.endswith('.svg')) if 'json' in request.form: json_data = json.loads(request.form['json']) else: -- cgit v1.2.3