mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-15 14:51:19 -08:00
- 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.
24 lines
No EOL
888 B
Python
24 lines
No EOL
888 B
Python
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Platform-appropriate directories
|
|
def get_config_dir() -> Path:
|
|
"""Get platform-appropriate config directory."""
|
|
if sys.platform == "win32":
|
|
return Path(os.environ.get("APPDATA", Path.home() / "AppData" / "Roaming"))
|
|
elif sys.platform == "darwin":
|
|
return Path.home() / "Library" / "Application Support"
|
|
else: # Linux and other UNIX-like
|
|
return Path.home() / ".config"
|
|
|
|
PACKAGE_NAME = "g4f"
|
|
CONFIG_DIR = get_config_dir() / PACKAGE_NAME
|
|
COOKIES_DIR = CONFIG_DIR / "cookies"
|
|
CUSTOM_COOKIES_DIR = "./har_and_cookies"
|
|
ORGANIZATION = "gpt4free"
|
|
GITHUB_REPOSITORY = f"xtekky/{ORGANIZATION}"
|
|
STATIC_DOMAIN = f"{PACKAGE_NAME}.dev"
|
|
STATIC_URL = f"https://{STATIC_DOMAIN}/"
|
|
DIST_DIR = f"./{STATIC_DOMAIN}/dist"
|
|
DOWNLOAD_URL = f"https://raw.githubusercontent.com/{ORGANIZATION}/{STATIC_DOMAIN}/refs/heads/main/" |