import os import platform import uuid from typing import List, Dict import httpx from dotenv import load_dotenv from pydantic_settings import BaseSettings load_dotenv() class Settings(BaseSettings): APP_SECRET: str = os.getenv('APP_SECRET', '') TOKEN: str = os.getenv('TOKEN', '') PROJECT_NAME: str = os.getenv('PROJECT_NAME', 'FastAPI') DESCRIPTION: str = os.getenv('DESCRIPTION', 'FastAPI template') FIREBASE_API_KEY: str = os.getenv('FIREBASE_API_KEY', '') REFRESH_TOKEN: str = os.getenv('REFRESH_TOKEN', '') AUTHORIZATION_TOKEN: str = os.getenv('AUTHORIZATION_TOKEN', '') ALLOWED_MODELS: List[Dict[str, str]] = [ {"id": "gpt-4o", "name": "GPT-4o [thinkbuddy]"}, {"id": "claude-3-5-sonnet", "name": "Claude 3.5 Sonnet v2 [thinkbuddy]"}, {"id": "gemini-2-flash", "name": "Gemini 2 Flash [thinkbuddy]"}, {"id": "nova-pro", "name": "Nova Pro [thinkbuddy]"}, {"id": "deepseek-v3", "name": "DeepSeek v3 [thinkbuddy]"}, {"id": "llama-3-3", "name": "Llama 3.3 (70B) [thinkbuddy]"}, {"id": "mistral-large-2", "name": "Mistral Large v2 [thinkbuddy]"}, {"id": "command-r-plus", "name": "Command R+ [thinkbuddy]"}, {"id": "o1-preview", "name": "o1-preview [thinkbuddy]"}, {"id": "o1-mini", "name": "o1-mini [thinkbuddy]"}, {"id": "gemini-2-thinking", "name": "Gemini 2 Thinking [thinkbuddy]"}, {"id": "claude-3-5-haiku", "name": "Claude 3.5 Haiku [thinkbuddy]"}, {"id": "gemini-1-5-flash", "name": "Gemini 1.5 Flash [thinkbuddy]"}, {"id": "gpt-4o-mini", "name": "GPT-4o mini [thinkbuddy]"}, {"id": "nova-lite", "name": "Nova Lite [thinkbuddy]"}, {"id": "gemini-1-5-pro", "name": "Gemini 1.5 Pro [thinkbuddy]"}, {"id": "claude-3-opus", "name": "Claude 3 Opus [thinkbuddy]"}, {"id": "gpt-4-turbo", "name": "GPT-4 Turbo [thinkbuddy]"}, {"id": "llama-3-1", "name": "Llama 3.1 [thinkbuddy]"} ] MODEL_MAPPING: Dict[str, str] = { "gpt-4o": "gpt-4o", "o1-preview": "o1-preview", "claude-3-5-sonnet": "claude-3-5-sonnet", "o1-mini": "o1-mini", "gemini-1.5-pro": "gemini-1.5-pro", "gemini-2.0-flash": "gemini-2.0-flash", } HEADERS: Dict[str, str] = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36', 'Accept-Encoding': 'gzip, deflate, br, zstd', 'Content-Type': 'application/json', 'sec-ch-ua-platform': 'Windows', 'authorization': f"Bearer {os.getenv('TOKEN', '')}", 'sec-ch-ua': '"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"', 'dnt': '1', 'sec-ch-ua-mobile': '?0', 'origin': 'https://thinkbuddy.ai', 'sec-fetch-site': 'same-site', 'sec-fetch-mode': 'cors', 'sec-fetch-dest': 'empty', 'referer': 'https://thinkbuddy.ai/', 'accept-language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh-TW;q=0.7,zh;q=0.6', 'priority': 'u=1, i' } class Config: env_file = '.env' case_sensitive = True _settings = None def get_settings(): global _settings if _settings is None: _settings = Settings() return _settings