From 74a33f10dd4bcac9e9f9716ffa27d3876fc976a0 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sat, 9 Mar 2024 19:05:05 +0100 Subject: Add word count from iG8R Improve Bing provider Some gui improvments Improve error handling in gui --- g4f/Provider/GeminiPro.py | 2 +- g4f/Provider/bing/conversation.py | 2 +- g4f/gui/client/css/style.css | 22 ++-- g4f/gui/client/html/index.html | 5 - g4f/gui/client/js/chat.v1.js | 210 +++++++++++++++++++------------------- 5 files changed, 122 insertions(+), 119 deletions(-) diff --git a/g4f/Provider/GeminiPro.py b/g4f/Provider/GeminiPro.py index a22304d5..4e31915a 100644 --- a/g4f/Provider/GeminiPro.py +++ b/g4f/Provider/GeminiPro.py @@ -32,7 +32,7 @@ class GeminiPro(AsyncGeneratorProvider, ProviderModelMixin): connector: BaseConnector = None, **kwargs ) -> AsyncResult: - model = "gemini-pro-vision" if model is None and image is not None else model + model = "gemini-pro-vision" if not model and image is not None else model model = cls.get_model(model) if not api_key: diff --git a/g4f/Provider/bing/conversation.py b/g4f/Provider/bing/conversation.py index 919d9c1d..4af9e5fe 100644 --- a/g4f/Provider/bing/conversation.py +++ b/g4f/Provider/bing/conversation.py @@ -46,7 +46,7 @@ async def create_conversation(session: ClientSession, proxy: str = None) -> Conv } for k, v in headers.items(): session.headers[k] = v - url = 'https://www.bing.com/turing/conversation/create?bundleVersion=1.1579.2' + url = 'https://www.bing.com/turing/conversation/create?bundleVersion=1.1626.1' async with session.get(url, headers=headers, proxy=proxy) as response: try: data = await response.json() diff --git a/g4f/gui/client/css/style.css b/g4f/gui/client/css/style.css index 9e42b1e3..eb71fa72 100644 --- a/g4f/gui/client/css/style.css +++ b/g4f/gui/client/css/style.css @@ -205,6 +205,12 @@ body { gap: 10px; } +.conversations .convo .choise { + position: absolute; + right: 8px; + background-color: var(--blur-bg); +} + .conversations i { color: var(--conversations); cursor: pointer; @@ -227,6 +233,10 @@ body { padding-bottom: 0; } +.message.regenerate { + opacity: 0.75; +} + .message:last-child { animation: 0.6s show_message; } @@ -397,7 +407,7 @@ body { padding: 6px var(--inner-gap); } -.stop_generating, .regenerate { +.stop_generating, .toolbar .regenerate { position: absolute; z-index: 1000000; top: 0; @@ -405,14 +415,14 @@ body { } @media only screen and (min-width: 40em) { - .stop_generating, .regenerate { + .stop_generating, .toolbar .regenerate { left: 50%; transform: translateX(-50%); right: auto; } } -.stop_generating button, .regenerate button{ +.stop_generating button, .toolbar .regenerate button{ backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); background-color: var(--blur-bg); @@ -602,7 +612,6 @@ select { .input-box { display: flex; align-items: center; - padding-right: var(--inner-gap); cursor: pointer; } @@ -991,8 +1000,9 @@ a:-webkit-any-link { padding-right: 5px; padding-top: 2px; padding-bottom: 2px; - top: 20px; - left: 8px; + position: absolute; + bottom: 8px; + right: 8px; } #send-button:hover { diff --git a/g4f/gui/client/html/index.html b/g4f/gui/client/html/index.html index 5a9d1178..85192d23 100644 --- a/g4f/gui/client/html/index.html +++ b/g4f/gui/client/html/index.html @@ -37,10 +37,6 @@ import llamaTokenizer from "llama-tokenizer-js" -