Skip to content

Commit

Permalink
Update You.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hlohaus authored Apr 7, 2024
1 parent b29b541 commit c9abf5c
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions g4f/Provider/You.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@
import json
import base64
import uuid
try:
from ..requests import FormData
has_curl_cffi = True
except ImportError:
has_curl_cffi = False

from ..typing import AsyncResult, Messages, ImageType, Cookies
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
from .helper import format_prompt
from ..image import to_bytes, ImageResponse
from ..requests import StreamSession, raise_for_status
from ..errors import MissingRequirementsError
from ..requests import StreamSession, FormData, raise_for_status

from .you.har_file import get_dfp_telemetry_id

Expand Down Expand Up @@ -55,8 +49,6 @@ async def create_async_generator(
chat_mode: str = "default",
**kwargs,
) -> AsyncResult:
#if not has_curl_cffi:
# raise MissingRequirementsError('Install or update "curl_cffi" package | pip install -U curl_cffi')
if image is not None:
chat_mode = "agent"
elif not model or model == cls.default_model:
Expand All @@ -72,13 +64,6 @@ async def create_async_generator(
) as session:
cookies = await cls.get_cookies(session) if chat_mode != "default" else None
upload = json.dumps([await cls.upload_file(session, cookies, to_bytes(image), image_name)]) if image else ""
#questions = [message["content"] for message in messages if message["role"] == "user"]
# chat = [
# {"question": questions[idx-1], "answer": message["content"]}
# for idx, message in enumerate(messages)
# if message["role"] == "assistant"
# and idx < len(questions)
# ]
headers = {
"Accept": "text/event-stream",
"Referer": f"{cls.url}/search?fromSearchBar=true&tbm=youchat",
Expand Down

0 comments on commit c9abf5c

Please sign in to comment.