From 4bab6009c13490a35be4327712f9e9243552d43c Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 19 May 2024 01:33:05 +0200 Subject: Fix js error in gui, Revert to_image in gui --- g4f/gui/client/static/js/chat.v1.js | 2 +- g4f/gui/server/backend.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'g4f') diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js index 46d5039e..1d0b0dce 100644 --- a/g4f/gui/client/static/js/chat.v1.js +++ b/g4f/gui/client/static/js/chat.v1.js @@ -302,7 +302,7 @@ const prepare_messages = (messages, message_index = -1) => { } messages.forEach((new_message) => { // Include only not regenerated messages - if (!new_message.regenerate) { + if (new_message && !new_message.regenerate) { // Remove generated images from history new_message.content = filter_message(new_message.content); delete new_message.provider; diff --git a/g4f/gui/server/backend.py b/g4f/gui/server/backend.py index b8da0221..d9e31c0e 100644 --- a/g4f/gui/server/backend.py +++ b/g4f/gui/server/backend.py @@ -1,6 +1,6 @@ import json from flask import request, Flask -from g4f.image import is_allowed_extension, to_bytes +from g4f.image import is_allowed_extension, to_image from .api import Api class Backend_Api(Api): @@ -79,7 +79,7 @@ class Backend_Api(Api): if "file" in request.files: file = request.files['file'] if file.filename != '' and is_allowed_extension(file.filename): - kwargs['image'] = to_bytes(file.stream) + kwargs['image'] = to_image(file.stream, file.filename.endswith('.svg')) kwargs['image_name'] = file.filename if "json" in request.form: json_data = json.loads(request.form['json']) -- cgit v1.2.3 From 3703e72073f17faf200545202d9f68f768857951 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 19 May 2024 03:13:54 +0200 Subject: Add dark mode config, slide system prompt --- g4f/gui/client/index.html | 10 ++- g4f/gui/client/static/css/style.css | 135 +++++------------------------------- g4f/gui/client/static/js/chat.v1.js | 23 ++++++ 3 files changed, 50 insertions(+), 118 deletions(-) (limited to 'g4f') diff --git a/g4f/gui/client/index.html b/g4f/gui/client/index.html index d3cddd3c..3c428f38 100644 --- a/g4f/gui/client/index.html +++ b/g4f/gui/client/index.html @@ -92,6 +92,11 @@