From 13b6fdef989e8229ed2c73c7f6c2dc07ca5edf18 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 5 Jan 2025 20:20:25 +0100 Subject: [PATCH] Add files requirements --- docker/Dockerfile | 2 +- g4f/gui/client/static/css/style.css | 8 ++++++-- g4f/gui/client/static/js/chat.v1.js | 7 ++++--- requirements.txt | 5 +++-- setup.py | 19 +++++++++---------- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 625312e2..a84703aa 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -78,7 +78,7 @@ RUN pip install --break-system-packages --upgrade pip \ && pip install --break-system-packages \ undetected-chromedriver selenium-wire \ && pip uninstall -y --break-system-packages \ - pywebview plyer + pywebview # Copy the entire package into the container. ADD --chown=$G4F_USER:$G4F_USER g4f $G4F_DIR/g4f diff --git a/g4f/gui/client/static/css/style.css b/g4f/gui/client/static/css/style.css index c079326e..db185e41 100644 --- a/g4f/gui/client/static/css/style.css +++ b/g4f/gui/client/static/css/style.css @@ -1126,8 +1126,12 @@ ul { display: flex; } - #systemPrompt { - padding-left: 48px; + #systemPrompt::placeholder { + text-align: center; + } + + .settings h3 { + text-align: center; } } diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js index 8eb1c224..fc4b0c5b 100644 --- a/g4f/gui/client/static/js/chat.v1.js +++ b/g4f/gui/client/static/js/chat.v1.js @@ -734,10 +734,11 @@ const ask_gpt = async (message_id, message_index = -1, regenerate = false, provi messages = prepare_messages(conversation.items, message_index, action=="continue"); message_storage[message_id] = ""; stop_generating.classList.remove("stop_generating-hidden"); - const scroll = true; - if (message_index > 0 && message_index + 1 < messages.length) { + let scroll = true; + if (message_index > 0 && parseInt(message_index, 10) + 1 < conversation.items.length) { scroll = false; } + if (scroll) { await lazy_scroll_to_bottom(); } @@ -1157,7 +1158,7 @@ const load_conversation = async (conversation_id, scroll=true) => { highlight(message_box); regenerate_button.classList.remove("regenerate-hidden"); - if (document.querySelector("#input-count input").checked) { + if (scroll && document.querySelector("#input-count input").checked) { message_box.scrollTo({ top: message_box.scrollHeight, behavior: "smooth" }); setTimeout(() => { diff --git a/requirements.txt b/requirements.txt index 11c34d59..13d951e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,8 @@ brotli beautifulsoup4 aiohttp_socks pywebview -plyer cryptography nodriver -python-multipart \ No newline at end of file +python-multipart +pypdf2 +docx \ No newline at end of file diff --git a/setup.py b/setup.py index d16c19fb..e0978771 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ EXTRA_REQUIRE = { "curl_cffi>=0.6.2", "certifi", "browser_cookie3", # get_cookies - "duckduckgo-search>=5.0" ,# internet.search + "duckduckgo-search>=5.0", # internet.search "beautifulsoup4", # internet.search and bing.create_images "platformdirs", "aiohttp_socks", # proxy @@ -36,6 +36,11 @@ EXTRA_REQUIRE = { "uvicorn", # api "nodriver", "python-multipart", + "pypdf2", # files + "docx", + "odfpy", + "ebooklib", + "openpyxl", ], 'slim': [ "curl_cffi>=0.6.2", @@ -49,22 +54,17 @@ EXTRA_REQUIRE = { "fastapi", # api "uvicorn", # api "python-multipart", + "pypdf2", # files + "docx", ], "image": [ "pillow", "cairosvg", "beautifulsoup4" ], - "webdriver": [ - "platformdirs", - "undetected-chromedriver>=3.5.5", - "setuptools", - "selenium-wire" - ], "webview": [ - "webview", + "pywebview", "platformdirs", - "plyer", "cryptography" ], "api": [ @@ -87,7 +87,6 @@ EXTRA_REQUIRE = { ], "files": [ "spacy", - "filesplit", "beautifulsoup4", "pypdf2", "docx",