From db2d6cffd9268e8842f0c2aa8e062c0e19d88d28 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 21 Apr 2024 07:22:59 +0200 Subject: Fix Bing Provider, Add Account Support for Meta AI Use default headers in OpenaiChat --- g4f/Provider/bing/conversation.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'g4f/Provider/bing') diff --git a/g4f/Provider/bing/conversation.py b/g4f/Provider/bing/conversation.py index 85292079..4cfeef8e 100644 --- a/g4f/Provider/bing/conversation.py +++ b/g4f/Provider/bing/conversation.py @@ -1,7 +1,6 @@ from __future__ import annotations -from aiohttp import ClientSession -from ...requests import raise_for_status +from ...requests import StreamSession, raise_for_status from ...errors import RateLimitError from ...providers.conversation import BaseConversation @@ -22,7 +21,7 @@ class Conversation(BaseConversation): self.clientId = clientId self.conversationSignature = conversationSignature -async def create_conversation(session: ClientSession, headers: dict, tone: str) -> Conversation: +async def create_conversation(session: StreamSession, headers: dict, tone: str) -> Conversation: """ Create a new conversation asynchronously. @@ -49,7 +48,7 @@ async def create_conversation(session: ClientSession, headers: dict, tone: str) raise RuntimeError('Empty fields: Failed to create conversation') return Conversation(conversationId, clientId, conversationSignature) -async def list_conversations(session: ClientSession) -> list: +async def list_conversations(session: StreamSession) -> list: """ List all conversations asynchronously. @@ -64,7 +63,7 @@ async def list_conversations(session: ClientSession) -> list: response = await response.json() return response["chats"] -async def delete_conversation(session: ClientSession, conversation: Conversation, headers: dict) -> bool: +async def delete_conversation(session: StreamSession, conversation: Conversation, headers: dict) -> bool: """ Delete a conversation asynchronously. -- cgit v1.2.3