From 63b7e96c289b34959048db825e7273d8a84ed68a Mon Sep 17 00:00:00 2001 From: hlohaus <983577+hlohaus@users.noreply.github.com> Date: Sat, 1 Feb 2025 00:46:37 +0100 Subject: Fix styling in GUI, improve mobile support --- g4f/api/__init__.py | 6 +++-- g4f/gui/client/index.html | 2 +- g4f/gui/client/static/css/style.css | 24 ++++++++++++------- g4f/gui/client/static/js/chat.v1.js | 48 ++++++++++++++++++++++++++----------- 4 files changed, 55 insertions(+), 25 deletions(-) diff --git a/g4f/api/__init__.py b/g4f/api/__init__.py index 9b5dafd8..af274d9b 100644 --- a/g4f/api/__init__.py +++ b/g4f/api/__init__.py @@ -9,6 +9,7 @@ import shutil from email.utils import formatdate import os.path import hashlib +import asyncio from fastapi import FastAPI, Response, Request, UploadFile, Depends from fastapi.middleware.wsgi import WSGIMiddleware from fastapi.responses import StreamingResponse, RedirectResponse, HTMLResponse, JSONResponse @@ -540,8 +541,9 @@ class Api: content_type = getattr(provider_handler, "synthesize_content_type", "application/octet-stream") return StreamingResponse(response_data, media_type=content_type) - @self.app.get("/json/{filename}") + @self.app.post("/json/{filename}") async def get_json(filename, request: Request): + await asyncio.sleep(30) return "" @self.app.get("/images/{filename}", responses={ @@ -580,7 +582,7 @@ class Api: if len(source_url) > 1: source_url = source_url[1] source_url = source_url.replace("%2F", "/").replace("%3A", ":").replace("%3F", "?") - if source_url.startswith("http"): + if source_url.startswith("https://"): await copy_images( [source_url], target=target) diff --git a/g4f/gui/client/index.html b/g4f/gui/client/index.html index fc796647..370b4867 100644 --- a/g4f/gui/client/index.html +++ b/g4f/gui/client/index.html @@ -248,7 +248,7 @@