diff options
Diffstat (limited to '')
-rw-r--r-- | g4f/gui/client/html/index.html | 1 | ||||
-rw-r--r-- | g4f/gui/client/js/chat.v1.js | 19 | ||||
-rw-r--r-- | g4f/providers/helper.py | 6 |
3 files changed, 20 insertions, 6 deletions
diff --git a/g4f/gui/client/html/index.html b/g4f/gui/client/html/index.html index 102a762e..9ef8a820 100644 --- a/g4f/gui/client/html/index.html +++ b/g4f/gui/client/html/index.html @@ -173,7 +173,6 @@ <option value="">Provider: Auto</option> <option value="Bing">Bing</option> <option value="OpenaiChat">OpenaiChat</option> - <option value="HuggingChat">HuggingChat</option> <option value="Gemini">Gemini</option> <option value="Liaobots">Liaobots</option> <option value="Phind">Phind</option> diff --git a/g4f/gui/client/js/chat.v1.js b/g4f/gui/client/js/chat.v1.js index c727dbf9..edd27689 100644 --- a/g4f/gui/client/js/chat.v1.js +++ b/g4f/gui/client/js/chat.v1.js @@ -121,6 +121,20 @@ const remove_cancel_button = async () => { }; const filter_messages = (messages) => { + // Removes none user messages at end + let last_message; + while (last_message = new_messages.pop()) { + if (last_message["role"] == "user") { + new_messages.push(last_message); + break; + } + } + + // Remove history, if it is selected + if (document.getElementById('history')?.checked) { + messages = [messages[messages.length-1]]; + } + let new_messages = []; for (i in messages) { new_message = messages[i]; @@ -135,6 +149,7 @@ const filter_messages = (messages) => { new_messages.push(new_message) } } + return new_messages; } @@ -143,10 +158,6 @@ const ask_gpt = async () => { messages = await get_messages(window.conversation_id); total_messages = messages.length; - // Remove history, if it is selected - if (document.getElementById('history')?.checked) { - messages = [messages[messages.length-1]]; - } messages = filter_messages(messages); window.scrollTo(0, 0); diff --git a/g4f/providers/helper.py b/g4f/providers/helper.py index 49d033d1..6981f984 100644 --- a/g4f/providers/helper.py +++ b/g4f/providers/helper.py @@ -55,7 +55,11 @@ def get_connector(connector: BaseConnector = None, proxy: str = None) -> Optiona if proxy and not connector: try: from aiohttp_socks import ProxyConnector - connector = ProxyConnector.from_url(proxy) + rdns = False + if proxy.startswith("socks5h://"): + proxy = proxy.replace("socks5h://", "socks5://") + rdns = True + connector = ProxyConnector.from_url(proxy, rdns=rdns) except ImportError: raise MissingRequirementsError('Install "aiohttp_socks" package for proxy support') return connector
\ No newline at end of file |