test24 / api /config.py
Niansuh's picture
Update api/config.py
2bdb4ed verified
raw
history blame
3.67 kB
# config.py
from __future__ import annotations
import os
import random
import string
# Base URL
BASE_URL = "https://www.blackbox.ai"
# Application Secret
APP_SECRET = os.getenv("APP_SECRET")
# Default Model
DEFAULT_MODEL = 'blackboxai'
# Image Models
IMAGE_MODELS = ['Image Generation', 'repomap']
# User Selected Models
USER_SELECTED_MODELS = ['gpt-4o', 'gemini-pro', 'claude-sonnet-3.5', 'blackboxai-pro']
# 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"},
'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"},
'blackboxai-pro': {'mode': True, 'id': "BLACKBOXAI-PRO"},
'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"@{value['id']}" for mode, value 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"]
}
# Models List
MODELS = [
DEFAULT_MODEL,
*USER_SELECTED_MODELS,
*list(AGENT_MODE.keys()),
*list(TRENDING_AGENT_MODE.keys()),
]
# Model Aliases
MODEL_ALIASES = {
"gemini-flash": "gemini-1.5-flash",
"claude-3.5-sonnet": "claude-sonnet-3.5",
"flux": "Image Generation",
}
# Function to get the model name
def get_model(model: str) -> str:
if model in MODELS:
return model
elif model in MODEL_ALIASES:
return MODEL_ALIASES[model]
else:
return DEFAULT_MODEL
# Function to generate a random alphanumeric ID
def generate_id(length=7):
characters = string.ascii_letters + string.digits
return ''.join(random.choice(characters) for _ in range(length))