Commit graph

4 commits

Author SHA1 Message Date
hlohaus
867b3e8c7e Refactor ApiAirforce class to enhance async generator and improve rate limit handling; update setup.py dependencies 2025-10-08 09:12:32 +02:00
hlohaus
4132b0a494 feat: add image size support and update nodriver args handling
- **ApiAirforce.py**: Added `use_image_size = True` class attribute.
- **EasyChat.py**: Added `user_data_dir=None` argument when calling `get_args_from_nodriver`.
- **LMArenaBeta.py**:
  - Only set `cls.share_url` from `G4F_SHARE_URL` if `cls.share_url` is `None`.
  - Added `user_data_dir=None` argument when calling `get_args_from_nodriver`.
  - Modified media filtering to check `url` is a `str` before `startswith("https://")`.
- **OpenaiTemplate.py**:
  - Added `use_image_size = False` class attribute.
  - Modified image generation payload to optionally include `"size"` key when `use_image_size` is `True` and width/height present.
  - Refactored `read_response` to store `content` in a variable, strip on first chunk, and yield `ToolCalls` directly from `tool_calls` variable.
- **g4f/requests/__init__.py**:
  - Added `user_data_dir` parameter (default `"nodriver"`) to `get_args_from_nodriver`.
  - Passed `user_data_dir` to `get_nodriver` call.
2025-08-11 15:48:16 +02:00
hlohaus
933b2e15d1 refactor: move DuckDuckGo/Free2GPT to deprecated; SearXNG updates
- g4f/Provider/ApiAirforce.py: replace class attr parent="Api.Airforce" with label="Api.Airforce"
- g4f/Provider/EasyChat.py: add guard after loop to raise ValueError("Failed to retrieve arguments for EasyChat.") when args is falsy
- g4f/Provider/SearXNG.py:
  - add imports: from .helper import format_media_prompt; from .. import debug
  - rename class attr default_url to url (SEARXNG_URL) and use cls.url in requests
  - create(): add parameters prompt: str = None and language: str = "it"
  - build prompt via format_media_prompt(messages, prompt); remove previous query extraction
  - request params: set q to prompt and language to provided language
  - pass proxy to session.get(...); replace print(...) with debug.log(...)
  - on empty results, return early (remove "Nessun risultato trovato." and FinishReason("stop") yields)
  - result formatting: use r.get("title") without default fallback
- g4f/Provider/__init__.py: import DuckDuckGo and Free2GPT from .deprecated.DuckDuckGo and .deprecated.Free2GPT
- g4f/Provider/deprecated/DuckDuckGo.py: update relative imports to ...typing, ..base_provider, ..helper
- g4f/Provider/deprecated/Free2GPT.py: update relative imports to ...errors, ...requests, ...typing, ..base_provider
- g4f/Provider/needs_auth/DeepSeekAPI.py: set working = False (was has_dsk)
- g4f/Provider/needs_auth/You.py: set working = False (was True); update headers["Referer"] to f"{cls.url}/api/streamingSearch"
2025-08-11 00:42:18 +02:00
hlohaus
05148d2b30 Add ApiAirforce provider 2025-08-10 22:28:11 +02:00