summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/needs_auth/MetaAIAccount.py
blob: 0a586006546a94ae06854a97a0682db0794f4751 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import annotations

from ...typing import AsyncResult, Messages, Cookies
from ..helper import format_prompt, get_cookies
from .MetaAI import MetaAI

class MetaAIAccount(MetaAI):
    needs_auth = True
    parent = "MetaAI"
    image_models = ["meta"]

    @classmethod
    async def create_async_generator(
        cls,
        model: str,
        messages: Messages,
        proxy: str = None,
        cookies: Cookies = None,
        **kwargs
    ) -> AsyncResult:
        cookies = get_cookies(".meta.ai", True, True) if cookies is None else cookies
        async for chunk in cls(proxy).prompt(format_prompt(messages), cookies):
            yield chunk