mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
Add Path and PathLike support when uploading images (#2514)
* Add Path and PathLike support when uploading images Improve raise_for_status in special cases Move ImageResponse to providers.response module Improve OpenaiChat and OpenaiAccount providers Add Sources for web_search in OpenaiChat Add JsonConversation for import and export conversations to js Add RequestLogin response type Add TitleGeneration support in OpenaiChat and gui * Improve Docker Container Guide in README.md * Add tool calls api support, add search tool support
This commit is contained in:
parent
9918df98b3
commit
86e36efe6b
34 changed files with 935 additions and 1333 deletions
|
|
@ -18,18 +18,19 @@ try:
|
|||
except ImportError:
|
||||
has_nodriver = False
|
||||
|
||||
from .base_provider import AbstractProvider, ProviderModelMixin, BaseConversation
|
||||
from .base_provider import AbstractProvider, ProviderModelMixin
|
||||
from .helper import format_prompt_max_length
|
||||
from .openai.har_file import get_headers, get_har_files
|
||||
from ..typing import CreateResult, Messages, ImagesType
|
||||
from ..errors import MissingRequirementsError, NoValidHarFileError
|
||||
from ..requests.raise_for_status import raise_for_status
|
||||
from ..providers.response import JsonConversation, RequestLogin
|
||||
from ..providers.asyncio import get_running_loop
|
||||
from .openai.har_file import get_headers, get_har_files
|
||||
from ..requests import get_nodriver
|
||||
from ..image import ImageResponse, to_bytes, is_accepted_format
|
||||
from .. import debug
|
||||
|
||||
class Conversation(BaseConversation):
|
||||
class Conversation(JsonConversation):
|
||||
conversation_id: str
|
||||
|
||||
def __init__(self, conversation_id: str):
|
||||
|
|
@ -80,7 +81,7 @@ class Copilot(AbstractProvider, ProviderModelMixin):
|
|||
if has_nodriver:
|
||||
login_url = os.environ.get("G4F_LOGIN_URL")
|
||||
if login_url:
|
||||
yield f"[Login to {cls.label}]({login_url})\n\n"
|
||||
yield RequestLogin(cls.label, login_url)
|
||||
get_running_loop(check_nested=True)
|
||||
cls._access_token, cls._cookies = asyncio.run(get_access_token_and_cookies(cls.url, proxy))
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue