import os from dotenv import load_dotenv import random import string load_dotenv() # Base URL and API Endpoint BASE_URL = "https://www.blackbox.ai" API_ENDPOINT = "https://www.blackbox.ai/api/chat" # Common Headers COMMON_HEADERS = { 'accept': '*/*', 'accept-language': 'en-US,en;q=0.9', 'cache-control': 'no-cache', 'content-type': 'application/json', 'origin': BASE_URL, 'pragma': 'no-cache', 'priority': 'u=1, i', 'referer': f'{BASE_URL}/', 'sec-ch-ua': '"Not?A_Brand";v="99", "Chromium";v="130"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Linux"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': ( 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/130.0.0.0 Safari/537.36' ), } # Header Configurations for Specific API Calls def get_headers_api_chat(): return COMMON_HEADERS.copy() def get_headers_chat(chat_url, next_action, next_router_state_tree): return { **COMMON_HEADERS, 'Accept': 'text/x-component', 'Content-Type': 'text/plain;charset=UTF-8', 'Referer': chat_url, 'next-action': next_action, 'next-router-state-tree': next_router_state_tree, 'next-url': '/', } APP_SECRET = os.getenv("APP_SECRET") # Model Configurations ALLOWED_MODELS = [ {"id": "blackboxai", "name": "blackboxai"}, {"id": "blackboxai-pro", "name": "blackboxai-pro"}, {"id": "flux", "name": "flux"}, {"id": "llama-3.1-8b", "name": "llama-3.1-8b"}, {"id": "llama-3.1-70b", "name": "llama-3.1-70b"}, {"id": "llama-3.1-405b", "name": "llama-3.1-405"}, {"id": "gpt-4o", "name": "gpt-4o"}, {"id": "gemini-pro", "name": "gemini-pro"}, {"id": "gemini-1.5-flash", "name": "gemini-1.5-flash"}, {"id": "claude-sonnet-3.5", "name": "claude-sonnet-3.5"}, {"id": "Python Agent", "name": "Python Agent"}, {"id": "Java Agent", "name": "Java Agent"}, {"id": "JavaScript Agent", "name": "JavaScript Agent"}, {"id": "HTML Agent", "name": "HTML Agent"}, {"id": "Google Cloud Agent", "name": "Google Cloud Agent"}, {"id": "Android Developer", "name": "Android Developer"}, {"id": "Swift Developer", "name": "Swift Developer"}, {"id": "Next.js Agent", "name": "Next.js Agent"}, {"id": "MongoDB Agent", "name": "MongoDB Agent"}, {"id": "PyTorch Agent", "name": "PyTorch Agent"}, {"id": "React Agent", "name": "React Agent"}, {"id": "Xcode Agent", "name": "Xcode Agent"}, {"id": "AngularJS Agent", "name": "AngularJS Agent"}, {"id": "repomap", "name": "repomap"}, {"id": "Heroku Agent", "name": "Heroku Agent"}, {"id": "Godot Agent", "name": "Godot Agent"}, {"id": "Go Agent", "name": "Go Agent"}, {"id": "Gitlab Agent", "name": "Gitlab Agent"}, {"id": "Git Agent", "name": "Git Agent"}, {"id": "Flask Agent", "name": "Flask Agent"}, {"id": "Firebase Agent", "name": "Firebase Agent"}, {"id": "FastAPI Agent", "name": "FastAPI Agent"}, {"id": "Erlang Agent", "name": "Erlang Agent"}, {"id": "Electron Agent", "name": "Electron Agent"}, {"id": "Docker Agent", "name": "Docker Agent"}, {"id": "DigitalOcean Agent", "name": "DigitalOcean Agent"}, {"id": "Bitbucket Agent", "name": "Bitbucket Agent"}, {"id": "Azure Agent", "name": "Azure Agent"}, {"id": "Flutter Agent", "name": "Flutter Agent"}, {"id": "Youtube Agent", "name": "Youtube Agent"}, {"id": "builder Agent", "name": "builder Agent"}, ] # Model Aliases MODEL_ALIASES = { "gemini-flash": "gemini-1.5-flash", "claude-3.5-sonnet": "claude-sonnet-3.5", "flux": "Image Generation", } # Agent Modes AGENT_MODE = { 'Image Generation': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "Image Generation"}, } # Trending Agent Modes TRENDING_AGENT_MODE = { "gemini-1.5-flash": {'mode': True, 'id': 'Gemini'}, "llama-3.1-8b": {'mode': True, 'id': "llama-3.1-8b"}, 'llama-3.1-70b': {'mode': True, 'id': "llama-3.1-70b"}, 'llama-3.1-405b': {'mode': True, 'id': "llama-3.1-405"}, 'blackboxai-pro': {'mode': True, 'id': "BLACKBOXAI-PRO"}, 'Python Agent': {'mode': True, 'id': "Python Agent"}, 'Java Agent': {'mode': True, 'id': "Java Agent"}, 'JavaScript Agent': {'mode': True, 'id': "JavaScript Agent"}, 'HTML Agent': {'mode': True, 'id': "HTML Agent"}, 'Google Cloud Agent': {'mode': True, 'id': "Google Cloud Agent"}, 'Android Developer': {'mode': True, 'id': "Android Developer"}, 'Swift Developer': {'mode': True, 'id': "Swift Developer"}, 'Next.js Agent': {'mode': True, 'id': "Next.js Agent"}, 'MongoDB Agent': {'mode': True, 'id': "MongoDB Agent"}, 'PyTorch Agent': {'mode': True, 'id': "PyTorch Agent"}, 'React Agent': {'mode': True, 'id': "React Agent"}, 'Xcode Agent': {'mode': True, 'id': "Xcode Agent"}, 'AngularJS Agent': {'mode': True, 'id': "AngularJS Agent"}, 'repomap': {'mode': True, 'id': "repomap"}, 'Heroku Agent': {'mode': True, 'id': "Heroku Agent"}, 'Godot Agent': {'mode': True, 'id': "Godot Agent"}, 'Go Agent': {'mode': True, 'id': "Go Agent"}, 'Gitlab Agent': {'mode': True, 'id': "Gitlab Agent"}, 'Git Agent': {'mode': True, 'id': "Git Agent"}, 'Flask Agent': {'mode': True, 'id': "Flask Agent"}, 'Firebase Agent': {'mode': True, 'id': "Firebase Agent"}, 'FastAPI Agent': {'mode': True, 'id': "FastAPI Agent"}, 'Erlang Agent': {'mode': True, 'id': "Erlang Agent"}, 'Electron Agent': {'mode': True, 'id': "Electron Agent"}, 'Docker Agent': {'mode': True, 'id': "Docker Agent"}, 'DigitalOcean Agent': {'mode': True, 'id': "DigitalOcean Agent"}, 'Bitbucket Agent': {'mode': True, 'id': "Bitbucket Agent"}, 'Azure Agent': {'mode': True, 'id': "Azure Agent"}, 'Flutter Agent': {'mode': True, 'id': "Flutter Agent"}, 'Youtube Agent': {'mode': True, 'id': "Youtube Agent"}, 'builder Agent': {'mode': True, 'id': "builder Agent"}, } # Model Prefixes MODEL_PREFIXES = { mode: f"@{details['id']}" for mode, details in TRENDING_AGENT_MODE.items() if mode not in ["gemini-1.5-flash", "llama-3.1-8b", "llama-3.1-70b", "llama-3.1-405b", "repomap"] } # Consolidate all models MODELS = [model["id"] for model in ALLOWED_MODELS] # Remove MODEL_REFERERS as per your request # Generate a random ID def generate_id(length=7): characters = string.ascii_letters + string.digits return ''.join(random.choice(characters) for _ in range(length))