gpt4free/g4f/requests/defaults.py
hlohaus 51b4b8bcb3 feat: add model alias handling and update Cloudflare provider
- Introduced `clean_name` function in `Cloudflare.py` to format model names by removing specific suffixes.
- Updated `model_aliases` in `Cloudflare` class with new model mappings, and cleaned up redundant entries.
- Set `models` in the `Cloudflare` class to use keys from `model_aliases`.
- Adjusted the caching logic in `Cloudflare` to include new headers for requests.
- Added `parent` and `login_url` attributes in `DeepInfraChat` class.
- Updated `PollinationsAI` to clean up model retrieval logic and fixed handling of existing checks.
- Refactored `HarProvider` to inherit models and aliases from `LegacyLMArena`.
- Implemented loading environment variables from `.env` file in `cookies.py`.
- Updated default headers in `defaults.py` for user agent and `sec-ch-ua`.
- Cleaned up various model references in `any_model_map.py` to reflect differences in audio, vision, and other model types.
- Added a more centralized handling for API key management in `run_tools.py` to accommodate new nomenclature.
- Enhanced existing logic to allow for more granular loading and utilization of API keys from environment variables.
2025-07-10 03:28:02 +02:00

29 lines
No EOL
896 B
Python

try:
import brotli
has_brotli = True
except ImportError:
has_brotli = False
DEFAULT_HEADERS = {
"accept": "*/*",
"accept-encoding": "gzip, deflate" + (", br" if has_brotli else ""),
"accept-language": "en-US",
"referer": "",
"sec-ch-ua": '"Chromium";v="136", "Google Chrome";v="136", "Not.A/Brand";v="99"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",
}
WEBVIEW_HAEDERS = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "",
"Referer": "",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-origin",
"User-Agent": "",
}