MetaAIAccount.py 672 B

123456789101112131415161718192021222324
  1. from __future__ import annotations
  2. from ...typing import AsyncResult, Messages, Cookies
  3. from ..helper import format_prompt, get_cookies
  4. from .MetaAI import MetaAI
  5. class MetaAIAccount(MetaAI):
  6. needs_auth = True
  7. parent = "MetaAI"
  8. image_models = ["meta"]
  9. @classmethod
  10. async def create_async_generator(
  11. cls,
  12. model: str,
  13. messages: Messages,
  14. proxy: str = None,
  15. cookies: Cookies = None,
  16. **kwargs
  17. ) -> AsyncResult:
  18. cookies = get_cookies(".meta.ai", True, True) if cookies is None else cookies
  19. async for chunk in cls(proxy).prompt(format_prompt(messages), cookies):
  20. yield chunk