Update api/config.py
Browse files- api/config.py +23 -37
api/config.py
CHANGED
@@ -3,35 +3,35 @@ from dotenv import load_dotenv
|
|
3 |
|
4 |
load_dotenv()
|
5 |
|
6 |
-
# Base URL and
|
7 |
BASE_URL = "https://www.blackbox.ai"
|
8 |
API_ENDPOINT = f"{BASE_URL}/api/chat"
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
}
|
31 |
|
32 |
-
# Model configurations
|
33 |
APP_SECRET = os.getenv("APP_SECRET")
|
34 |
|
|
|
35 |
ALLOWED_MODELS = [
|
36 |
{"id": "blackboxai", "name": "blackboxai"},
|
37 |
{"id": "blackboxai-pro", "name": "blackboxai-pro"},
|
@@ -62,14 +62,6 @@ ALLOWED_MODELS = [
|
|
62 |
{"id": "GitlabAgent", "name": "GitlabAgent"},
|
63 |
{"id": "GitAgent", "name": "GitAgent"},
|
64 |
{"id": "RepoMap", "name": "RepoMap"},
|
65 |
-
{"id": "gemini-1.5-pro-latest", "name": "gemini-pro"},
|
66 |
-
{"id": "gemini-1.5-pro", "name": "gemini-1.5-pro"},
|
67 |
-
{"id": "claude-3-5-sonnet-20240620", "name": "claude-sonnet-3.5"},
|
68 |
-
{"id": "claude-3-5-sonnet", "name": "claude-sonnet-3.5"},
|
69 |
-
{"id": "Niansuh", "name": "Niansuh"},
|
70 |
-
{"id": "o1-preview", "name": "o1-preview"},
|
71 |
-
|
72 |
-
# Added New Agents
|
73 |
{"id": "FlaskAgent", "name": "FlaskAgent"},
|
74 |
{"id": "FirebaseAgent", "name": "FirebaseAgent"},
|
75 |
{"id": "FastAPIAgent", "name": "FastAPIAgent"},
|
@@ -84,10 +76,6 @@ ALLOWED_MODELS = [
|
|
84 |
{"id": "builderAgent", "name": "builderAgent"},
|
85 |
]
|
86 |
|
87 |
-
# Mapping of models for streamlined access
|
88 |
-
MODEL_MAPPING = {model['id']: model['name'] for model in ALLOWED_MODELS}
|
89 |
-
|
90 |
-
# Agent modes
|
91 |
AGENT_MODE = {
|
92 |
'flux': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "flux"},
|
93 |
'Niansuh': {'mode': True, 'id': "NiansuhAIk1HgESy", 'name': "Niansuh"},
|
@@ -120,8 +108,6 @@ TRENDING_AGENT_MODE = {
|
|
120 |
'GitlabAgent': {'mode': True, 'id': "GitlabAgent"},
|
121 |
'GitAgent': {'mode': True, 'id': "GitAgent"},
|
122 |
'RepoMap': {'mode': True, 'id': "repomap"},
|
123 |
-
|
124 |
-
# Added New Agents
|
125 |
'FlaskAgent': {'mode': True, 'id': "FlaskAgent"},
|
126 |
'FirebaseAgent': {'mode': True, 'id': "FirebaseAgent"},
|
127 |
'FastAPIAgent': {'mode': True, 'id': "FastAPIAgent"},
|
|
|
3 |
|
4 |
load_dotenv()
|
5 |
|
6 |
+
# Base URL and Common Headers
|
7 |
BASE_URL = "https://www.blackbox.ai"
|
8 |
API_ENDPOINT = f"{BASE_URL}/api/chat"
|
9 |
|
10 |
+
common_headers = {
|
11 |
+
'accept': '*/*',
|
12 |
+
'accept-language': 'en-US,en;q=0.9',
|
13 |
+
'cache-control': 'no-cache',
|
14 |
+
'content-type': 'application/json',
|
15 |
+
'origin': BASE_URL,
|
16 |
+
'pragma': 'no-cache',
|
17 |
+
'priority': 'u=1, i',
|
18 |
+
'referer': f'{BASE_URL}/',
|
19 |
+
'sec-ch-ua': '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
|
20 |
+
'sec-ch-ua-mobile': '?0',
|
21 |
+
'sec-ch-ua-platform': '"Windows"',
|
22 |
+
'sec-fetch-dest': 'empty',
|
23 |
+
'sec-fetch-mode': 'cors',
|
24 |
+
'sec-fetch-site': 'same-origin',
|
25 |
+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36',
|
26 |
+
}
|
27 |
+
|
28 |
+
# Header Configurations for Specific API Calls
|
29 |
+
def get_headers_api_chat(referer_url):
|
30 |
+
return {**common_headers, 'Referer': referer_url}
|
31 |
|
|
|
32 |
APP_SECRET = os.getenv("APP_SECRET")
|
33 |
|
34 |
+
# Allowed Models and Agent Modes
|
35 |
ALLOWED_MODELS = [
|
36 |
{"id": "blackboxai", "name": "blackboxai"},
|
37 |
{"id": "blackboxai-pro", "name": "blackboxai-pro"},
|
|
|
62 |
{"id": "GitlabAgent", "name": "GitlabAgent"},
|
63 |
{"id": "GitAgent", "name": "GitAgent"},
|
64 |
{"id": "RepoMap", "name": "RepoMap"},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
{"id": "FlaskAgent", "name": "FlaskAgent"},
|
66 |
{"id": "FirebaseAgent", "name": "FirebaseAgent"},
|
67 |
{"id": "FastAPIAgent", "name": "FastAPIAgent"},
|
|
|
76 |
{"id": "builderAgent", "name": "builderAgent"},
|
77 |
]
|
78 |
|
|
|
|
|
|
|
|
|
79 |
AGENT_MODE = {
|
80 |
'flux': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "flux"},
|
81 |
'Niansuh': {'mode': True, 'id': "NiansuhAIk1HgESy", 'name': "Niansuh"},
|
|
|
108 |
'GitlabAgent': {'mode': True, 'id': "GitlabAgent"},
|
109 |
'GitAgent': {'mode': True, 'id': "GitAgent"},
|
110 |
'RepoMap': {'mode': True, 'id': "repomap"},
|
|
|
|
|
111 |
'FlaskAgent': {'mode': True, 'id': "FlaskAgent"},
|
112 |
'FirebaseAgent': {'mode': True, 'id': "FirebaseAgent"},
|
113 |
'FastAPIAgent': {'mode': True, 'id': "FastAPIAgent"},
|