|
|
|
|
|
from __future__ import annotations |
|
|
|
import os |
|
import random |
|
import string |
|
|
|
|
|
BASE_URL = "https://www.blackbox.ai" |
|
|
|
|
|
APP_SECRET = os.getenv("APP_SECRET") |
|
|
|
|
|
DEFAULT_MODEL = 'blackboxai' |
|
|
|
|
|
IMAGE_MODELS = ['Image Generation', 'repomap'] |
|
|
|
|
|
USER_SELECTED_MODELS = ['gpt-4o', 'gemini-pro', 'claude-sonnet-3.5', 'blackboxai-pro'] |
|
|
|
|
|
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"}, |
|
'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 = { |
|
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 = [ |
|
DEFAULT_MODEL, |
|
*USER_SELECTED_MODELS, |
|
*list(AGENT_MODE.keys()), |
|
*list(TRENDING_AGENT_MODE.keys()), |
|
] |
|
|
|
|
|
MODEL_ALIASES = { |
|
"gemini-flash": "gemini-1.5-flash", |
|
"claude-3.5-sonnet": "claude-sonnet-3.5", |
|
"flux": "Image Generation", |
|
} |
|
|
|
|
|
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 |
|
|
|
|
|
def generate_id(length=7): |
|
characters = string.ascii_letters + string.digits |
|
return ''.join(random.choice(characters) for _ in range(length)) |
|
|