Update api/config.py
Browse files- api/config.py +101 -147
api/config.py
CHANGED
@@ -6,17 +6,17 @@ load_dotenv()
|
|
6 |
# Base URL
|
7 |
BASE_URL = "https://www.blackbox.ai"
|
8 |
|
9 |
-
#
|
10 |
-
def
|
11 |
return {
|
12 |
'accept': '*/*',
|
13 |
'accept-language': 'en-US,en;q=0.9',
|
14 |
'cache-control': 'no-cache',
|
15 |
'content-type': 'application/json',
|
16 |
-
'origin':
|
17 |
'pragma': 'no-cache',
|
18 |
'priority': 'u=1, i',
|
19 |
-
'referer':
|
20 |
'sec-ch-ua': '"Not?A_Brand";v="99", "Chromium";v="130"',
|
21 |
'sec-ch-ua-mobile': '?0',
|
22 |
'sec-ch-ua-platform': '"Linux"',
|
@@ -28,163 +28,117 @@ def get_headers():
|
|
28 |
'Chrome/130.0.0.0 Safari/537.36',
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
APP_SECRET = os.getenv("APP_SECRET")
|
32 |
|
|
|
33 |
ALLOWED_MODELS = [
|
34 |
{"id": "blackboxai", "name": "blackboxai"},
|
35 |
-
{"id": "blackboxai-pro", "name": "blackboxai-pro"},
|
36 |
-
{"id": "flux", "name": "flux"},
|
37 |
-
{"id": "llama-3.1-8b", "name": "llama-3.1-8b"},
|
38 |
-
{"id": "llama-3.1-70b", "name": "llama-3.1-70b"},
|
39 |
-
{"id": "llama-3.1-405b", "name": "llama-3.1-405"},
|
40 |
{"id": "gpt-4o", "name": "gpt-4o"},
|
41 |
{"id": "gemini-pro", "name": "gemini-pro"},
|
42 |
-
{"id": "gemini-1.5-flash", "name": "gemini-1.5-flash"},
|
43 |
{"id": "claude-sonnet-3.5", "name": "claude-sonnet-3.5"},
|
44 |
-
{"id": "
|
45 |
-
{"id": "
|
46 |
-
{"id": "
|
47 |
-
{"id": "
|
48 |
-
{"id": "
|
49 |
-
{"id": "
|
50 |
-
{"id": "
|
51 |
-
|
52 |
-
{"id": "
|
53 |
-
{"id": "
|
54 |
-
{"id": "
|
55 |
-
{"id": "
|
56 |
-
{"id": "
|
57 |
-
{"id": "
|
58 |
-
{"id": "
|
59 |
-
{"id": "
|
60 |
-
{"id": "
|
61 |
-
{"id": "
|
62 |
-
{"id": "
|
63 |
-
{"id": "
|
64 |
-
{"id": "
|
65 |
-
{"id": "
|
66 |
-
{"id": "
|
67 |
-
{"id": "
|
68 |
-
{"id": "
|
69 |
-
|
70 |
-
#
|
71 |
-
{"id": "
|
72 |
-
{"id": "
|
73 |
-
{"id": "
|
74 |
-
{"id": "
|
75 |
-
{"id": "
|
76 |
-
{"id": "
|
77 |
-
{"id": "
|
78 |
-
{"id": "
|
79 |
-
{"id": "
|
80 |
-
{"id": "
|
81 |
-
{"id": "
|
82 |
-
{"id": "
|
83 |
]
|
84 |
|
85 |
-
|
86 |
-
"blackboxai": "blackboxai",
|
87 |
-
"blackboxai-pro": "blackboxai-pro",
|
88 |
-
"flux": "flux",
|
89 |
-
"ImageGeneration": "flux",
|
90 |
-
"llama-3.1-8b": "llama-3.1-8b",
|
91 |
-
"llama-3.1-70b": "llama-3.1-70b",
|
92 |
-
"llama-3.1-405b": "llama-3.1-405",
|
93 |
-
"gpt-4o": "gpt-4o",
|
94 |
-
"gemini-pro": "gemini-pro",
|
95 |
-
"gemini-1.5-flash": "gemini-1.5-flash",
|
96 |
-
"claude-sonnet-3.5": "claude-sonnet-3.5",
|
97 |
-
"PythonAgent": "PythonAgent",
|
98 |
-
"JavaAgent": "JavaAgent",
|
99 |
-
"JavaScriptAgent": "JavaScriptAgent",
|
100 |
-
"HTMLAgent": "HTMLAgent",
|
101 |
-
"GoogleCloudAgent": "GoogleCloudAgent",
|
102 |
-
"AndroidDeveloper": "AndroidDeveloper",
|
103 |
-
"SwiftDeveloper": "SwiftDeveloper",
|
104 |
-
"Next.jsAgent": "Next.jsAgent",
|
105 |
-
"MongoDBAgent": "MongoDBAgent",
|
106 |
-
"PyTorchAgent": "PyTorchAgent",
|
107 |
-
"ReactAgent": "ReactAgent",
|
108 |
-
"XcodeAgent": "XcodeAgent",
|
109 |
-
"AngularJSAgent": "AngularJSAgent",
|
110 |
-
"HerokuAgent": "HerokuAgent",
|
111 |
-
"GodotAgent": "GodotAgent",
|
112 |
-
"GoAgent": "GoAgent",
|
113 |
-
"GitlabAgent": "GitlabAgent",
|
114 |
-
"GitAgent": "GitAgent",
|
115 |
-
"RepoMap": "RepoMap",
|
116 |
-
# Additional mappings
|
117 |
-
"gemini-flash": "gemini-1.5-flash",
|
118 |
-
"claude-3.5-sonnet": "claude-sonnet-3.5",
|
119 |
-
"gemini-1.5-pro-latest": "gemini-pro",
|
120 |
-
"gemini-1.5-pro": "gemini-1.5-pro",
|
121 |
-
"claude-3-5-sonnet-20240620": "claude-sonnet-3.5",
|
122 |
-
"claude-3-5-sonnet": "claude-sonnet-3.5",
|
123 |
-
"Niansuh": "Niansuh",
|
124 |
-
"o1-preview": "o1-preview",
|
125 |
-
|
126 |
-
# Added New Agents
|
127 |
-
"FlaskAgent": "FlaskAgent",
|
128 |
-
"FirebaseAgent": "FirebaseAgent",
|
129 |
-
"FastAPIAgent": "FastAPIAgent",
|
130 |
-
"ErlangAgent": "ErlangAgent",
|
131 |
-
"ElectronAgent": "ElectronAgent",
|
132 |
-
"DockerAgent": "DockerAgent",
|
133 |
-
"DigitalOceanAgent": "DigitalOceanAgent",
|
134 |
-
"BitbucketAgent": "BitbucketAgent",
|
135 |
-
"AzureAgent": "AzureAgent",
|
136 |
-
"FlutterAgent": "FlutterAgent",
|
137 |
-
"YoutubeAgent": "YoutubeAgent",
|
138 |
-
"builderAgent": "builderAgent",
|
139 |
-
}
|
140 |
-
|
141 |
-
# Agent modes (No changes needed)
|
142 |
AGENT_MODE = {
|
143 |
-
'
|
144 |
-
'Niansuh': {'mode': True, 'id': "NiansuhAIk1HgESy", 'name': "Niansuh"},
|
145 |
-
'o1-preview': {'mode': True, 'id': "o1Dst8La8", 'name': "o1-preview"},
|
146 |
}
|
147 |
|
148 |
TRENDING_AGENT_MODE = {
|
149 |
-
"blackboxai": {},
|
150 |
"gemini-1.5-flash": {'mode': True, 'id': 'Gemini'},
|
151 |
"llama-3.1-8b": {'mode': True, 'id': "llama-3.1-8b"},
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
'YoutubeAgent': {'mode': True, 'id': "Youtube Agent"},
|
187 |
-
'builderAgent': {'mode': True, 'id': "builder Agent"},
|
188 |
}
|
189 |
|
190 |
-
# Removed MODEL_PREFIXES
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
# Base URL
|
7 |
BASE_URL = "https://www.blackbox.ai"
|
8 |
|
9 |
+
# Header Configurations for API Calls (updated to include headers directly)
|
10 |
+
def get_headers_api_chat(referer_url):
|
11 |
return {
|
12 |
'accept': '*/*',
|
13 |
'accept-language': 'en-US,en;q=0.9',
|
14 |
'cache-control': 'no-cache',
|
15 |
'content-type': 'application/json',
|
16 |
+
'origin': BASE_URL,
|
17 |
'pragma': 'no-cache',
|
18 |
'priority': 'u=1, i',
|
19 |
+
'referer': referer_url,
|
20 |
'sec-ch-ua': '"Not?A_Brand";v="99", "Chromium";v="130"',
|
21 |
'sec-ch-ua-mobile': '?0',
|
22 |
'sec-ch-ua-platform': '"Linux"',
|
|
|
28 |
'Chrome/130.0.0.0 Safari/537.36',
|
29 |
}
|
30 |
|
31 |
+
def get_headers_chat(chat_url, next_action, next_router_state_tree):
|
32 |
+
return {
|
33 |
+
'Accept': 'text/x-component',
|
34 |
+
'Content-Type': 'text/plain;charset=UTF-8',
|
35 |
+
'Referer': chat_url,
|
36 |
+
'next-action': next_action,
|
37 |
+
'next-router-state-tree': next_router_state_tree,
|
38 |
+
'next-url': '/',
|
39 |
+
}
|
40 |
+
|
41 |
APP_SECRET = os.getenv("APP_SECRET")
|
42 |
|
43 |
+
# Updated models list without model prefixes and adjusted model referers
|
44 |
ALLOWED_MODELS = [
|
45 |
{"id": "blackboxai", "name": "blackboxai"},
|
|
|
|
|
|
|
|
|
|
|
46 |
{"id": "gpt-4o", "name": "gpt-4o"},
|
47 |
{"id": "gemini-pro", "name": "gemini-pro"},
|
|
|
48 |
{"id": "claude-sonnet-3.5", "name": "claude-sonnet-3.5"},
|
49 |
+
{"id": "blackboxai-pro", "name": "blackboxai-pro"},
|
50 |
+
{"id": "Image Generation", "name": "Image Generation"},
|
51 |
+
{"id": "repomap", "name": "repomap"},
|
52 |
+
{"id": "gemini-1.5-flash", "name": "gemini-1.5-flash"},
|
53 |
+
{"id": "llama-3.1-8b", "name": "llama-3.1-8b"},
|
54 |
+
{"id": "llama-3.1-70b", "name": "llama-3.1-70b"},
|
55 |
+
{"id": "llama-3.1-405b", "name": "llama-3.1-405b"},
|
56 |
+
# Additional agents
|
57 |
+
{"id": "Python Agent", "name": "Python Agent"},
|
58 |
+
{"id": "Java Agent", "name": "Java Agent"},
|
59 |
+
{"id": "JavaScript Agent", "name": "JavaScript Agent"},
|
60 |
+
{"id": "HTML Agent", "name": "HTML Agent"},
|
61 |
+
{"id": "Google Cloud Agent", "name": "Google Cloud Agent"},
|
62 |
+
{"id": "Android Developer", "name": "Android Developer"},
|
63 |
+
{"id": "Swift Developer", "name": "Swift Developer"},
|
64 |
+
{"id": "Next.js Agent", "name": "Next.js Agent"},
|
65 |
+
{"id": "MongoDB Agent", "name": "MongoDB Agent"},
|
66 |
+
{"id": "PyTorch Agent", "name": "PyTorch Agent"},
|
67 |
+
{"id": "React Agent", "name": "React Agent"},
|
68 |
+
{"id": "Xcode Agent", "name": "Xcode Agent"},
|
69 |
+
{"id": "AngularJS Agent", "name": "AngularJS Agent"},
|
70 |
+
{"id": "Heroku Agent", "name": "Heroku Agent"},
|
71 |
+
{"id": "Godot Agent", "name": "Godot Agent"},
|
72 |
+
{"id": "Go Agent", "name": "Go Agent"},
|
73 |
+
{"id": "Gitlab Agent", "name": "Gitlab Agent"},
|
74 |
+
{"id": "Git Agent", "name": "Git Agent"},
|
75 |
+
# New agents
|
76 |
+
{"id": "Flask Agent", "name": "Flask Agent"},
|
77 |
+
{"id": "Firebase Agent", "name": "Firebase Agent"},
|
78 |
+
{"id": "FastAPI Agent", "name": "FastAPI Agent"},
|
79 |
+
{"id": "Erlang Agent", "name": "Erlang Agent"},
|
80 |
+
{"id": "Electron Agent", "name": "Electron Agent"},
|
81 |
+
{"id": "Docker Agent", "name": "Docker Agent"},
|
82 |
+
{"id": "DigitalOcean Agent", "name": "DigitalOcean Agent"},
|
83 |
+
{"id": "Bitbucket Agent", "name": "Bitbucket Agent"},
|
84 |
+
{"id": "Azure Agent", "name": "Azure Agent"},
|
85 |
+
{"id": "Flutter Agent", "name": "Flutter Agent"},
|
86 |
+
{"id": "Youtube Agent", "name": "Youtube Agent"},
|
87 |
+
{"id": "builder Agent", "name": "builder Agent"},
|
88 |
]
|
89 |
|
90 |
+
# Agent modes (updated)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
AGENT_MODE = {
|
92 |
+
'Image Generation': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "Image Generation"},
|
|
|
|
|
93 |
}
|
94 |
|
95 |
TRENDING_AGENT_MODE = {
|
|
|
96 |
"gemini-1.5-flash": {'mode': True, 'id': 'Gemini'},
|
97 |
"llama-3.1-8b": {'mode': True, 'id': "llama-3.1-8b"},
|
98 |
+
"llama-3.1-70b": {'mode': True, 'id': "llama-3.1-70b"},
|
99 |
+
"llama-3.1-405b": {'mode': True, 'id': "llama-3.1-405"},
|
100 |
+
"Python Agent": {'mode': True, 'id': "Python Agent"},
|
101 |
+
"Java Agent": {'mode': True, 'id': "Java Agent"},
|
102 |
+
"JavaScript Agent": {'mode': True, 'id': "JavaScript Agent"},
|
103 |
+
"HTML Agent": {'mode': True, 'id': "HTML Agent"},
|
104 |
+
"Google Cloud Agent": {'mode': True, 'id': "Google Cloud Agent"},
|
105 |
+
"Android Developer": {'mode': True, 'id': "Android Developer"},
|
106 |
+
"Swift Developer": {'mode': True, 'id': "Swift Developer"},
|
107 |
+
"Next.js Agent": {'mode': True, 'id': "Next.js Agent"},
|
108 |
+
"MongoDB Agent": {'mode': True, 'id': "MongoDB Agent"},
|
109 |
+
"PyTorch Agent": {'mode': True, 'id': "PyTorch Agent"},
|
110 |
+
"React Agent": {'mode': True, 'id': "React Agent"},
|
111 |
+
"Xcode Agent": {'mode': True, 'id': "Xcode Agent"},
|
112 |
+
"AngularJS Agent": {'mode': True, 'id': "AngularJS Agent"},
|
113 |
+
"Heroku Agent": {'mode': True, 'id': "Heroku Agent"},
|
114 |
+
"Godot Agent": {'mode': True, 'id': "Godot Agent"},
|
115 |
+
"Go Agent": {'mode': True, 'id': "Go Agent"},
|
116 |
+
"Gitlab Agent": {'mode': True, 'id': "Gitlab Agent"},
|
117 |
+
"Git Agent": {'mode': True, 'id': "Git Agent"},
|
118 |
+
"repomap": {'mode': True, 'id': "repomap"},
|
119 |
+
# New agents
|
120 |
+
"Flask Agent": {'mode': True, 'id': "Flask Agent"},
|
121 |
+
"Firebase Agent": {'mode': True, 'id': "Firebase Agent"},
|
122 |
+
"FastAPI Agent": {'mode': True, 'id': "FastAPI Agent"},
|
123 |
+
"Erlang Agent": {'mode': True, 'id': "Erlang Agent"},
|
124 |
+
"Electron Agent": {'mode': True, 'id': "Electron Agent"},
|
125 |
+
"Docker Agent": {'mode': True, 'id': "Docker Agent"},
|
126 |
+
"DigitalOcean Agent": {'mode': True, 'id': "DigitalOcean Agent"},
|
127 |
+
"Bitbucket Agent": {'mode': True, 'id': "Bitbucket Agent"},
|
128 |
+
"Azure Agent": {'mode': True, 'id': "Azure Agent"},
|
129 |
+
"Flutter Agent": {'mode': True, 'id': "Flutter Agent"},
|
130 |
+
"Youtube Agent": {'mode': True, 'id': "Youtube Agent"},
|
131 |
+
"builder Agent": {'mode': True, 'id': "builder Agent"},
|
|
|
|
|
132 |
}
|
133 |
|
134 |
+
# Removed MODEL_PREFIXES as per your requirement
|
135 |
+
|
136 |
+
# Updated model referers
|
137 |
+
MODEL_REFERERS = {
|
138 |
+
"blackboxai": "/",
|
139 |
+
"gpt-4o": "/",
|
140 |
+
"gemini-pro": "/",
|
141 |
+
"claude-sonnet-3.5": "/",
|
142 |
+
"blackboxai-pro": "/",
|
143 |
+
# Add other models if necessary
|
144 |
+
}
|