test24 / api /config.py
Niansuh's picture
Update api/config.py
b297abf verified
raw
history blame
6.14 kB
import os
from dotenv import load_dotenv
load_dotenv()
# Base URL
BASE_URL = "https://www.blackbox.ai"
# Header Configurations for API Calls (updated to include headers directly)
def get_headers_api_chat(referer_url):
return {
'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': referer_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',
}
def get_headers_chat(chat_url, next_action, next_router_state_tree):
return {
'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")
# Updated models list without model prefixes and adjusted model referers
ALLOWED_MODELS = [
{"id": "blackboxai", "name": "blackboxai"},
{"id": "gpt-4o", "name": "gpt-4o"},
{"id": "gemini-pro", "name": "gemini-pro"},
{"id": "claude-sonnet-3.5", "name": "claude-sonnet-3.5"},
{"id": "blackboxai-pro", "name": "blackboxai-pro"},
{"id": "Image Generation", "name": "Image Generation"},
{"id": "repomap", "name": "repomap"},
{"id": "gemini-1.5-flash", "name": "gemini-1.5-flash"},
{"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-405b"},
# Additional agents
{"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": "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"},
# New agents
{"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"},
]
# Agent modes (updated)
AGENT_MODE = {
'Image Generation': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "Image Generation"},
}
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"},
"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"},
"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"},
"repomap": {'mode': True, 'id': "repomap"},
# New agents
"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"},
}
# Removed MODEL_PREFIXES as per your requirement
# Updated model referers
MODEL_REFERERS = {
"blackboxai": "/",
"gpt-4o": "/",
"gemini-pro": "/",
"claude-sonnet-3.5": "/",
"blackboxai-pro": "/",
# Add other models if necessary
}