summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/HuggingChat.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-01-24 01:05:29 +0100
committerGitHub <noreply@github.com>2024-01-24 01:05:29 +0100
commit71d71b6512df12d6295c1f8323eb056edd89c57f (patch)
treedb88f2c8237b51519401e077df059b71f41e6404 /g4f/Provider/HuggingChat.py
parentMerge pull request #1509 from hlohaus/sort (diff)
parentAdd get_connector helper (diff)
downloadgpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar.gz
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar.bz2
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar.lz
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar.xz
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.tar.zst
gpt4free-71d71b6512df12d6295c1f8323eb056edd89c57f.zip
Diffstat (limited to '')
-rw-r--r--g4f/Provider/HuggingChat.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/g4f/Provider/HuggingChat.py b/g4f/Provider/HuggingChat.py
index d493da8f..79e4ae38 100644
--- a/g4f/Provider/HuggingChat.py
+++ b/g4f/Provider/HuggingChat.py
@@ -2,11 +2,11 @@ from __future__ import annotations
import json, uuid
-from aiohttp import ClientSession
+from aiohttp import ClientSession, BaseConnector
from ..typing import AsyncResult, Messages
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
-from .helper import format_prompt, get_cookies
+from .helper import format_prompt, get_cookies, get_connector
class HuggingChat(AsyncGeneratorProvider, ProviderModelMixin):
@@ -33,6 +33,7 @@ class HuggingChat(AsyncGeneratorProvider, ProviderModelMixin):
messages: Messages,
stream: bool = True,
proxy: str = None,
+ connector: BaseConnector = None,
web_search: bool = False,
cookies: dict = None,
**kwargs
@@ -45,7 +46,8 @@ class HuggingChat(AsyncGeneratorProvider, ProviderModelMixin):
}
async with ClientSession(
cookies=cookies,
- headers=headers
+ headers=headers,
+ connector=get_connector(connector, proxy)
) as session:
async with session.post(f"{cls.url}/conversation", json={"model": cls.get_model(model)}, proxy=proxy) as response:
conversation_id = (await response.json())["conversationId"]