Niansuh commited on
Commit
7818129
1 Parent(s): bee70be

Update api/config.py

Browse files
Files changed (1) hide show
  1. api/config.py +209 -74
api/config.py CHANGED
@@ -4,93 +4,228 @@ from dotenv import load_dotenv
4
  load_dotenv()
5
 
6
  BASE_URL = "https://www.blackbox.ai"
7
- APP_SECRET = os.getenv("APP_SECRET")
8
-
9
- # Headers for HTTP requests
10
- headers = {
11
  'accept': '*/*',
12
- 'accept-language': 'zh-CN,zh;q=0.9',
13
- 'content-type': 'application/json',
14
- 'origin': 'https://www.blackbox.ai',
15
- 'priority': 'u=1, i',
16
- 'sec-ch-ua': '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
17
- 'sec-ch-ua-mobile': '?0',
18
- 'sec-ch-ua-platform': '"Windows"',
19
- 'sec-fetch-dest': 'empty',
20
- 'sec-fetch-mode': 'cors',
21
- 'sec-fetch-site': 'same-origin',
22
- 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',
23
- }
24
 
25
- # Default model configuration
26
- default_model = 'blackboxai'
27
- userSelectedModel = ['gpt-4o', 'gemini-pro', 'claude-sonnet-3.5', 'blackboxai-pro']
28
- image_models = ['Image Generation', 'repomap']
29
 
30
- # Allowed models including all specified agent and trending models
31
  ALLOWED_MODELS = [
 
 
 
 
 
 
32
  {"id": "gpt-4o", "name": "gpt-4o"},
33
- {"id": "gemini-1.5-pro-latest", "name": "gemini-pro"},
34
- {"id": "gemini-1.5-pro", "name": "gemini-pro"},
35
  {"id": "gemini-pro", "name": "gemini-pro"},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  {"id": "claude-3-5-sonnet-20240620", "name": "claude-sonnet-3.5"},
37
  {"id": "claude-3-5-sonnet", "name": "claude-sonnet-3.5"},
38
- {"id": "blackboxai-pro", "name": "BLACKBOXAI-PRO"},
39
- {"id": "repomap", "name": "repomap"},
40
- # Add any additional agent models here
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  ]
42
 
43
- # Agent and trending agent modes
44
- agentMode = {
45
- 'Image Generation': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "Image Generation"},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
47
- trendingAgentMode = {
 
 
48
  "gemini-1.5-flash": {'mode': True, 'id': 'Gemini'},
49
  "llama-3.1-8b": {'mode': True, 'id': "llama-3.1-8b"},
50
- "llama-3.1-70b": {'mode': True, 'id': "llama-3.1-70b"},
51
- "llama-3.1-405b": {'mode': True, 'id': "llama-3.1-405b"},
52
- 'Python Agent': {'mode': True, 'id': "Python Agent"},
53
- 'Java Agent': {'mode': True, 'id': "Java Agent"},
54
- 'JavaScript Agent': {'mode': True, 'id': "JavaScript Agent"},
55
- 'HTML Agent': {'mode': True, 'id': "HTML Agent"},
56
- 'Google Cloud Agent': {'mode': True, 'id': "Google Cloud Agent"},
57
- 'Android Developer': {'mode': True, 'id': "Android Developer"},
58
- 'Swift Developer': {'mode': True, 'id': "Swift Developer"},
59
- 'Next.js Agent': {'mode': True, 'id': "Next.js Agent"},
60
- 'MongoDB Agent': {'mode': True, 'id': "MongoDB Agent"},
61
- 'PyTorch Agent': {'mode': True, 'id': "PyTorch Agent"},
62
- 'React Agent': {'mode': True, 'id': "React Agent"},
63
- 'Xcode Agent': {'mode': True, 'id': "Xcode Agent"},
64
- 'AngularJS Agent': {'mode': True, 'id': "AngularJS Agent"},
65
- 'repomap': {'mode': True, 'id': "repomap"},
66
- 'Heroku Agent': {'mode': True, 'id': "Heroku Agent"},
67
- 'Godot Agent': {'mode': True, 'id': "Godot Agent"},
68
- 'Go Agent': {'mode': True, 'id': "Go Agent"},
69
- 'Gitlab Agent': {'mode': True, 'id': "Gitlab Agent"},
70
- 'Git Agent': {'mode': True, 'id': "Git Agent"},
71
- 'Flask Agent': {'mode': True, 'id': "Flask Agent"},
72
- 'Firebase Agent': {'mode': True, 'id': "Firebase Agent"},
73
- 'FastAPI Agent': {'mode': True, 'id': "FastAPI Agent"},
74
- 'Erlang Agent': {'mode': True, 'id': "Erlang Agent"},
75
- 'Electron Agent': {'mode': True, 'id': "Electron Agent"},
76
- 'Docker Agent': {'mode': True, 'id': "Docker Agent"},
77
- 'DigitalOcean Agent': {'mode': True, 'id': "DigitalOcean Agent"},
78
- 'Bitbucket Agent': {'mode': True, 'id': "Bitbucket Agent"},
79
- 'Azure Agent': {'mode': True, 'id': "Azure Agent"},
80
- 'Flutter Agent': {'mode': True, 'id': "Flutter Agent"},
81
- 'Youtube Agent': {'mode': True, 'id': "Youtube Agent"},
82
- 'builder Agent': {'mode': True, 'id': "builder Agent"},
 
 
 
83
  }
84
 
85
- # Model prefixes for trending agent modes
86
- model_prefixes = {mode: f"@{value['id']}" for mode, value in trendingAgentMode.items() if mode not in ["gemini-1.5-flash", "llama-3.1-8b", "llama-3.1-70b", "llama-3.1-405b", "repomap"]}
87
-
88
- # Consolidated models list
89
- models = [default_model, *userSelectedModel, *list(agentMode.keys()), *list(trendingAgentMode.keys())]
90
-
91
- # Aliases for model names
92
- model_aliases = {
93
- "gemini-flash": "gemini-1.5-flash",
94
- "claude-3.5-sonnet": "claude-sonnet-3.5",
95
- "flux": "Image Generation",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
 
 
 
 
 
 
 
 
 
 
4
  load_dotenv()
5
 
6
  BASE_URL = "https://www.blackbox.ai"
7
+ common_headers = {
 
 
 
8
  'accept': '*/*',
9
+ 'accept-language': 'en-US,en;q=0.9',
10
+ 'cache-control': 'no-cache',
11
+ 'origin': BASE_URL,
12
+ 'pragma': 'no-cache',
13
+ 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
14
+ 'AppleWebKit/537.36 (KHTML, like Gecko) '
15
+ 'Chrome/130.0.0.0 Safari/537.36',
 
 
 
 
 
16
 
17
+ APP_SECRET = os.getenv("APP_SECRET")
 
 
 
18
 
 
19
  ALLOWED_MODELS = [
20
+ {"id": "blackboxai", "name": "blackboxai"},
21
+ {"id": "blackboxai-pro", "name": "blackboxai-pro"},
22
+ {"id": "flux", "name": "flux"},
23
+ {"id": "llama-3.1-8b", "name": "llama-3.1-8b"},
24
+ {"id": "llama-3.1-70b", "name": "llama-3.1-70b"},
25
+ {"id": "llama-3.1-405b", "name": "llama-3.1-405"},
26
  {"id": "gpt-4o", "name": "gpt-4o"},
 
 
27
  {"id": "gemini-pro", "name": "gemini-pro"},
28
+ {"id": "gemini-1.5-flash", "name": "gemini-1.5-flash"},
29
+ {"id": "claude-sonnet-3.5", "name": "claude-sonnet-3.5"},
30
+ {"id": "PythonAgent", "name": "PythonAgent"},
31
+ {"id": "JavaAgent", "name": "JavaAgent"},
32
+ {"id": "JavaScriptAgent", "name": "JavaScriptAgent"},
33
+ {"id": "HTMLAgent", "name": "HTMLAgent"},
34
+ {"id": "GoogleCloudAgent", "name": "GoogleCloudAgent"},
35
+ {"id": "AndroidDeveloper", "name": "AndroidDeveloper"},
36
+ {"id": "SwiftDeveloper", "name": "SwiftDeveloper"},
37
+ {"id": "Next.jsAgent", "name": "Next.jsAgent"},
38
+ {"id": "MongoDBAgent", "name": "MongoDBAgent"},
39
+ {"id": "PyTorchAgent", "name": "PyTorchAgent"},
40
+ {"id": "ReactAgent", "name": "ReactAgent"},
41
+ {"id": "XcodeAgent", "name": "XcodeAgent"},
42
+ {"id": "AngularJSAgent", "name": "AngularJSAgent"},
43
+ {"id": "HerokuAgent", "name": "HerokuAgent"},
44
+ {"id": "GodotAgent", "name": "GodotAgent"},
45
+ {"id": "GoAgent", "name": "GoAgent"},
46
+ {"id": "GitlabAgent", "name": "GitlabAgent"},
47
+ {"id": "GitAgent", "name": "GitAgent"},
48
+ {"id": "RepoMap", "name": "RepoMap"},
49
+ {"id": "gemini-1.5-pro-latest", "name": "gemini-pro"},
50
+ {"id": "gemini-1.5-pro", "name": "gemini-1.5-pro"},
51
  {"id": "claude-3-5-sonnet-20240620", "name": "claude-sonnet-3.5"},
52
  {"id": "claude-3-5-sonnet", "name": "claude-sonnet-3.5"},
53
+ {"id": "Niansuh", "name": "Niansuh"},
54
+ {"id": "o1-preview", "name": "o1-preview"},
55
+ {"id": "claude-3-5-sonnet-20241022", "name": "claude-3-5-sonnet-20241022"},
56
+ {"id": "claude-3-5-sonnet-x", "name": "claude-3-5-sonnet-x"},
57
+
58
+ # Added New Agents
59
+ {"id": "FlaskAgent", "name": "FlaskAgent"},
60
+ {"id": "FirebaseAgent", "name": "FirebaseAgent"},
61
+ {"id": "FastAPIAgent", "name": "FastAPIAgent"},
62
+ {"id": "ErlangAgent", "name": "ErlangAgent"},
63
+ {"id": "ElectronAgent", "name": "ElectronAgent"},
64
+ {"id": "DockerAgent", "name": "DockerAgent"},
65
+ {"id": "DigitalOceanAgent", "name": "DigitalOceanAgent"},
66
+ {"id": "BitbucketAgent", "name": "BitbucketAgent"},
67
+ {"id": "AzureAgent", "name": "AzureAgent"},
68
+ {"id": "FlutterAgent", "name": "FlutterAgent"},
69
+ {"id": "YoutubeAgent", "name": "YoutubeAgent"},
70
+ {"id": "builderAgent", "name": "builderAgent"},
71
  ]
72
 
73
+ MODEL_MAPPING = {
74
+ "blackboxai": "blackboxai",
75
+ "blackboxai-pro": "blackboxai-pro",
76
+ "flux": "flux",
77
+ "ImageGeneration": "flux",
78
+ "llama-3.1-8b": "llama-3.1-8b",
79
+ "llama-3.1-70b": "llama-3.1-70b",
80
+ "llama-3.1-405b": "llama-3.1-405",
81
+ "gpt-4o": "gpt-4o",
82
+ "gemini-pro": "gemini-pro",
83
+ "gemini-1.5-flash": "gemini-1.5-flash",
84
+ "claude-sonnet-3.5": "claude-sonnet-3.5",
85
+ "PythonAgent": "PythonAgent",
86
+ "JavaAgent": "JavaAgent",
87
+ "JavaScriptAgent": "JavaScriptAgent",
88
+ "HTMLAgent": "HTMLAgent",
89
+ "GoogleCloudAgent": "GoogleCloudAgent",
90
+ "AndroidDeveloper": "AndroidDeveloper",
91
+ "SwiftDeveloper": "SwiftDeveloper",
92
+ "Next.jsAgent": "Next.jsAgent",
93
+ "MongoDBAgent": "MongoDBAgent",
94
+ "PyTorchAgent": "PyTorchAgent",
95
+ "ReactAgent": "ReactAgent",
96
+ "XcodeAgent": "XcodeAgent",
97
+ "AngularJSAgent": "AngularJSAgent",
98
+ "HerokuAgent": "HerokuAgent",
99
+ "GodotAgent": "GodotAgent",
100
+ "GoAgent": "GoAgent",
101
+ "GitlabAgent": "GitlabAgent",
102
+ "GitAgent": "GitAgent",
103
+ "RepoMap": "RepoMap",
104
+ # Additional mappings
105
+ "gemini-flash": "gemini-1.5-flash",
106
+ "claude-3.5-sonnet": "claude-sonnet-3.5",
107
+ "flux": "flux",
108
+ "gemini-1.5-pro-latest": "gemini-pro",
109
+ "gemini-1.5-pro": "gemini-1.5-pro",
110
+ "claude-3-5-sonnet-20240620": "claude-sonnet-3.5",
111
+ "claude-3-5-sonnet": "claude-sonnet-3.5",
112
+ "Niansuh": "Niansuh",
113
+ "o1-preview": "o1-preview",
114
+ "claude-3-5-sonnet-20241022": "claude-3-5-sonnet-20241022",
115
+ "claude-3-5-sonnet-x": "claude-3-5-sonnet-x",
116
+
117
+ # Added New Agents
118
+ "FlaskAgent": "FlaskAgent",
119
+ "FirebaseAgent": "FirebaseAgent",
120
+ "FastAPIAgent": "FastAPIAgent",
121
+ "ErlangAgent": "ErlangAgent",
122
+ "ElectronAgent": "ElectronAgent",
123
+ "DockerAgent": "DockerAgent",
124
+ "DigitalOceanAgent": "DigitalOceanAgent",
125
+ "BitbucketAgent": "BitbucketAgent",
126
+ "AzureAgent": "AzureAgent",
127
+ "FlutterAgent": "FlutterAgent",
128
+ "YoutubeAgent": "YoutubeAgent",
129
+ "builderAgent": "builderAgent",
130
+ }
131
+
132
+ # Agent modes
133
+ AGENT_MODE = {
134
+ 'flux': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "flux"},
135
+ 'Niansuh': {'mode': True, 'id': "NiansuhAIk1HgESy", 'name': "Niansuh"},
136
+ 'o1-preview': {'mode': True, 'id': "o1Dst8La8", 'name': "o1-preview"},
137
+ 'claude-3-5-sonnet-20241022': {'mode': True, 'id': "Claude-Sonnet-3.5zO2HZSF", 'name': "claude-3-5-sonnet-20241022"},
138
+ 'claude-3-5-sonnet-x': {'mode': True, 'id': "Claude-Sonnet-3.52022JE0UdQ3", 'name': "claude-3-5-sonnet-x"},
139
  }
140
+
141
+ TRENDING_AGENT_MODE = {
142
+ "blackboxai": {},
143
  "gemini-1.5-flash": {'mode': True, 'id': 'Gemini'},
144
  "llama-3.1-8b": {'mode': True, 'id': "llama-3.1-8b"},
145
+ 'llama-3.1-70b': {'mode': True, 'id': "llama-3.1-70b"},
146
+ 'llama-3.1-405b': {'mode': True, 'id': "llama-3.1-405"},
147
+ 'blackboxai-pro': {'mode': True, 'id': "BLACKBOXAI-PRO"},
148
+ 'PythonAgent': {'mode': True, 'id': "Python Agent"},
149
+ 'JavaAgent': {'mode': True, 'id': "Java Agent"},
150
+ 'JavaScriptAgent': {'mode': True, 'id': "JavaScript Agent"},
151
+ 'HTMLAgent': {'mode': True, 'id': "HTML Agent"},
152
+ 'GoogleCloudAgent': {'mode': True, 'id': "Google Cloud Agent"},
153
+ 'AndroidDeveloper': {'mode': True, 'id': "Android Developer"},
154
+ 'SwiftDeveloper': {'mode': True, 'id': "Swift Developer"},
155
+ 'Next.jsAgent': {'mode': True, 'id': "Next.js Agent"},
156
+ 'MongoDBAgent': {'mode': True, 'id': "MongoDB Agent"},
157
+ 'PyTorchAgent': {'mode': True, 'id': "PyTorch Agent"},
158
+ 'ReactAgent': {'mode': True, 'id': "React Agent"},
159
+ 'XcodeAgent': {'mode': True, 'id': "Xcode Agent"},
160
+ 'AngularJSAgent': {'mode': True, 'id': "AngularJS Agent"},
161
+ 'HerokuAgent': {'mode': True, 'id': "HerokuAgent"},
162
+ 'GodotAgent': {'mode': True, 'id': "GodotAgent"},
163
+ 'GoAgent': {'mode': True, 'id': "GoAgent"},
164
+ 'GitlabAgent': {'mode': True, 'id': "GitlabAgent"},
165
+ 'GitAgent': {'mode': True, 'id': "GitAgent"},
166
+ 'RepoMap': {'mode': True, 'id': "repomap"},
167
+
168
+ # Added New Agents
169
+ 'FlaskAgent': {'mode': True, 'id': "FlaskAgent"},
170
+ 'FirebaseAgent': {'mode': True, 'id': "FirebaseAgent"},
171
+ 'FastAPIAgent': {'mode': True, 'id': "FastAPIAgent"},
172
+ 'ErlangAgent': {'mode': True, 'id': "ErlangAgent"},
173
+ 'ElectronAgent': {'mode': True, 'id': "ElectronAgent"},
174
+ 'DockerAgent': {'mode': True, 'id': "DockerAgent"},
175
+ 'DigitalOceanAgent': {'mode': True, 'id': "DigitalOceanAgent"},
176
+ 'BitbucketAgent': {'mode': True, 'id': "BitbucketAgent"},
177
+ 'AzureAgent': {'mode': True, 'id': "AzureAgent"},
178
+ 'FlutterAgent': {'mode': True, 'id': "FlutterAgent"},
179
+ 'YoutubeAgent': {'mode': True, 'id': "YoutubeAgent"},
180
+ 'builderAgent': {'mode': True, 'id': "builderAgent"},
181
  }
182
 
183
+ # Model prefixes
184
+ MODEL_PREFIXES = {
185
+ 'gpt-4o': '@GPT-4o',
186
+ 'gemini-pro': '@Gemini-PRO',
187
+ 'PythonAgent': '@Python Agent',
188
+ 'JavaAgent': '@Java Agent',
189
+ 'JavaScriptAgent': '@JavaScript Agent',
190
+ 'HTMLAgent': '@HTML Agent',
191
+ 'GoogleCloudAgent': '@Google Cloud Agent',
192
+ 'AndroidDeveloper': '@Android Developer',
193
+ 'SwiftDeveloper': '@Swift Developer',
194
+ 'Next.jsAgent': '@Next.js Agent',
195
+ 'MongoDBAgent': '@MongoDB Agent',
196
+ 'PyTorchAgent': '@PyTorch Agent',
197
+ 'ReactAgent': '@React Agent',
198
+ 'XcodeAgent': '@Xcode Agent',
199
+ 'AngularJSAgent': '@AngularJS Agent',
200
+ 'HerokuAgent': '@Heroku Agent',
201
+ 'GodotAgent': '@Godot Agent',
202
+ 'GoAgent': '@Go Agent',
203
+ 'GitlabAgent': '@Gitlab Agent',
204
+ 'GitAgent': '@Gitlab Agent',
205
+ 'blackboxai-pro': '@BLACKBOXAI-PRO',
206
+ 'flux': '@Image Generation',
207
+ # Add any additional prefixes if necessary
208
+
209
+ # Added New Agents
210
+ 'FlaskAgent': '@Flask Agent',
211
+ 'FirebaseAgent': '@Firebase Agent',
212
+ 'FastAPIAgent': '@FastAPI Agent',
213
+ 'ErlangAgent': '@Erlang Agent',
214
+ 'ElectronAgent': '@Electron Agent',
215
+ 'DockerAgent': '@Docker Agent',
216
+ 'DigitalOceanAgent': '@DigitalOcean Agent',
217
+ 'BitbucketAgent': '@Bitbucket Agent',
218
+ 'AzureAgent': '@Azure Agent',
219
+ 'FlutterAgent': '@Flutter Agent',
220
+ 'YoutubeAgent': '@Youtube Agent',
221
+ 'builderAgent': '@builder Agent',
222
  }
223
+
224
+ # Model referers
225
+ MODEL_REFERERS = {
226
+ "blackboxai": "/?model=blackboxai",
227
+ "gpt-4o": "/?model=gpt-4o",
228
+ "gemini-pro": "/?model=gemini-pro",
229
+ "claude-sonnet-3.5": "/?model=claude-sonnet-3.5",
230
+ # Add any additional referers if necessary
231
+ }