Niansuh commited on
Commit
d94491c
·
verified ·
1 Parent(s): d1a8ada

Update api/config.py

Browse files
Files changed (1) hide show
  1. api/config.py +32 -209
api/config.py CHANGED
@@ -3,27 +3,25 @@ from dotenv import load_dotenv
3
 
4
  load_dotenv()
5
 
6
- # Base URL and Common Headers
7
- BASE_URL = "https://www.blackbox.ai"
8
  common_headers = {
9
- 'accept': '*/*',
10
  'accept-language': 'en-US,en;q=0.9',
11
  'cache-control': 'no-cache',
12
  'origin': BASE_URL,
13
  'pragma': 'no-cache',
14
  'priority': 'u=1, i',
15
- 'sec-ch-ua': '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
16
  'sec-ch-ua-mobile': '?0',
17
- 'sec-ch-ua-platform': '"Windows"',
18
  'sec-fetch-dest': 'empty',
19
  'sec-fetch-mode': 'cors',
20
  'sec-fetch-site': 'same-origin',
21
- 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
22
- 'AppleWebKit/537.36 (KHTML, like Gecko) '
23
- 'Chrome/130.0.0.0 Safari/537.36',
24
  }
25
 
26
- # Header Configurations for Specific API Calls
27
  def get_headers_api_chat(referer_url):
28
  return {**common_headers, 'Content-Type': 'application/json', 'Referer': referer_url}
29
 
@@ -38,212 +36,37 @@ def get_headers_chat(chat_url, next_action, next_router_state_tree):
38
  'next-url': '/',
39
  }
40
 
 
41
  APP_SECRET = os.getenv("APP_SECRET")
42
 
43
- ALLOWED_MODELS = [
44
- {"id": "blackboxai", "name": "blackboxai"},
45
- {"id": "blackboxai-pro", "name": "blackboxai-pro"},
46
- {"id": "flux", "name": "flux"},
47
- {"id": "llama-3.1-8b", "name": "llama-3.1-8b"},
48
- {"id": "llama-3.1-70b", "name": "llama-3.1-70b"},
49
- {"id": "llama-3.1-405b", "name": "llama-3.1-405b"},
50
- {"id": "gpt-4o", "name": "gpt-4o"},
51
- {"id": "gemini-pro", "name": "gemini-pro"},
52
- {"id": "gemini-1.5-flash", "name": "gemini-1.5-flash"},
53
- {"id": "claude-sonnet-3.5", "name": "claude-sonnet-3.5"},
54
- {"id": "PythonAgent", "name": "PythonAgent"},
55
- {"id": "JavaAgent", "name": "JavaAgent"},
56
- {"id": "JavaScriptAgent", "name": "JavaScriptAgent"},
57
- {"id": "HTMLAgent", "name": "HTMLAgent"},
58
- {"id": "GoogleCloudAgent", "name": "GoogleCloudAgent"},
59
- {"id": "AndroidDeveloper", "name": "AndroidDeveloper"},
60
- {"id": "SwiftDeveloper", "name": "SwiftDeveloper"},
61
- {"id": "Next.jsAgent", "name": "Next.jsAgent"},
62
- {"id": "MongoDBAgent", "name": "MongoDBAgent"},
63
- {"id": "PyTorchAgent", "name": "PyTorchAgent"},
64
- {"id": "ReactAgent", "name": "ReactAgent"},
65
- {"id": "XcodeAgent", "name": "XcodeAgent"},
66
- {"id": "AngularJSAgent", "name": "AngularJSAgent"},
67
- {"id": "HerokuAgent", "name": "HerokuAgent"},
68
- {"id": "GodotAgent", "name": "GodotAgent"},
69
- {"id": "GoAgent", "name": "GoAgent"},
70
- {"id": "GitlabAgent", "name": "GitlabAgent"},
71
- {"id": "GitAgent", "name": "GitAgent"},
72
- {"id": "RepoMap", "name": "RepoMap"},
73
- {"id": "gemini-1.5-pro-latest", "name": "gemini-pro"},
74
- {"id": "gemini-1.5-pro", "name": "gemini-1.5-pro"},
75
- {"id": "claude-3-5-sonnet-20240620", "name": "claude-sonnet-3.5"},
76
- {"id": "claude-3-5-sonnet", "name": "claude-sonnet-3.5"},
77
- {"id": "Niansuh", "name": "Niansuh"},
78
- {"id": "o1-preview", "name": "o1-preview"},
79
-
80
- # Added New Agents
81
- {"id": "FlaskAgent", "name": "FlaskAgent"},
82
- {"id": "FirebaseAgent", "name": "FirebaseAgent"},
83
- {"id": "FastAPIAgent", "name": "FastAPIAgent"},
84
- {"id": "ErlangAgent", "name": "ErlangAgent"},
85
- {"id": "ElectronAgent", "name": "ElectronAgent"},
86
- {"id": "DockerAgent", "name": "DockerAgent"},
87
- {"id": "DigitalOceanAgent", "name": "DigitalOceanAgent"},
88
- {"id": "BitbucketAgent", "name": "BitbucketAgent"},
89
- {"id": "AzureAgent", "name": "AzureAgent"},
90
- {"id": "FlutterAgent", "name": "FlutterAgent"},
91
- {"id": "YoutubeAgent", "name": "YoutubeAgent"},
92
- {"id": "builderAgent", "name": "builderAgent"},
93
- ]
94
 
95
- MODEL_MAPPING = {
96
- "blackboxai": "blackboxai",
97
- "blackboxai-pro": "blackboxai-pro",
98
- "flux": "flux",
99
- "ImageGeneration": "flux",
100
- "llama-3.1-8b": "llama-3.1-8b",
101
- "llama-3.1-70b": "llama-3.1-70b",
102
- "llama-3.1-405b": "llama-3.1-405b",
103
- "gpt-4o": "gpt-4o",
104
- "gemini-pro": "gemini-pro",
105
- "gemini-1.5-flash": "gemini-1.5-flash",
106
- "claude-sonnet-3.5": "claude-sonnet-3.5",
107
- "PythonAgent": "PythonAgent",
108
- "JavaAgent": "JavaAgent",
109
- "JavaScriptAgent": "JavaScriptAgent",
110
- "HTMLAgent": "HTMLAgent",
111
- "GoogleCloudAgent": "GoogleCloudAgent",
112
- "AndroidDeveloper": "AndroidDeveloper",
113
- "SwiftDeveloper": "SwiftDeveloper",
114
- "Next.jsAgent": "Next.jsAgent",
115
- "MongoDBAgent": "MongoDBAgent",
116
- "PyTorchAgent": "PyTorchAgent",
117
- "ReactAgent": "ReactAgent",
118
- "XcodeAgent": "XcodeAgent",
119
- "AngularJSAgent": "AngularJSAgent",
120
- "HerokuAgent": "HerokuAgent",
121
- "GodotAgent": "GodotAgent",
122
- "GoAgent": "GoAgent",
123
- "GitlabAgent": "GitlabAgent",
124
- "GitAgent": "GitAgent",
125
- "RepoMap": "RepoMap",
126
- # Additional mappings
127
- "gemini-flash": "gemini-1.5-flash",
128
- "claude-3.5-sonnet": "claude-sonnet-3.5",
129
- "flux": "flux",
130
- "gemini-1.5-pro-latest": "gemini-pro",
131
- "gemini-1.5-pro": "gemini-1.5-pro",
132
- "claude-3-5-sonnet-20240620": "claude-sonnet-3.5",
133
- "claude-3-5-sonnet": "claude-sonnet-3.5",
134
- "Niansuh": "Niansuh",
135
- "o1-preview": "o1-preview",
136
-
137
- # Added New Agents
138
- "FlaskAgent": "FlaskAgent",
139
- "FirebaseAgent": "FirebaseAgent",
140
- "FastAPIAgent": "FastAPIAgent",
141
- "ErlangAgent": "ErlangAgent",
142
- "ElectronAgent": "ElectronAgent",
143
- "DockerAgent": "DockerAgent",
144
- "DigitalOceanAgent": "DigitalOceanAgent",
145
- "BitbucketAgent": "BitbucketAgent",
146
- "AzureAgent": "AzureAgent",
147
- "FlutterAgent": "FlutterAgent",
148
- "YoutubeAgent": "YoutubeAgent",
149
- "builderAgent": "builderAgent",
150
- }
151
 
152
- # Agent modes
153
- AGENT_MODE = {
154
- 'flux': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "flux"},
155
- 'Niansuh': {'mode': True, 'id': "NiansuhAIk1HgESy", 'name': "Niansuh"},
156
- 'o1-preview': {'mode': True, 'id': "o1Dst8La8", 'name': "o1-preview"},
 
157
  }
158
 
159
- TRENDING_AGENT_MODE = {
160
- "blackboxai": {},
161
- "gemini-1.5-flash": {'mode': True, 'id': 'Gemini'},
162
- "llama-3.1-8b": {'mode': True, 'id': "llama-3.1-8b"},
163
- 'llama-3.1-70b': {'mode': True, 'id': "llama-3.1-70b"},
164
- 'llama-3.1-405b': {'mode': True, 'id': "llama-3.1-405b"},
165
- 'blackboxai-pro': {'mode': True, 'id': "BLACKBOXAI-PRO"},
166
- 'PythonAgent': {'mode': True, 'id': "Python Agent"},
167
- 'JavaAgent': {'mode': True, 'id': "Java Agent"},
168
- 'JavaScriptAgent': {'mode': True, 'id': "JavaScript Agent"},
169
- 'HTMLAgent': {'mode': True, 'id': "HTML Agent"},
170
- 'GoogleCloudAgent': {'mode': True, 'id': "Google Cloud Agent"},
171
- 'AndroidDeveloper': {'mode': True, 'id': "Android Developer"},
172
- 'SwiftDeveloper': {'mode': True, 'id': "Swift Developer"},
173
- 'Next.jsAgent': {'mode': True, 'id': "Next.js Agent"},
174
- 'MongoDBAgent': {'mode': True, 'id': "MongoDB Agent"},
175
- 'PyTorchAgent': {'mode': True, 'id': "PyTorch Agent"},
176
- 'ReactAgent': {'mode': True, 'id': "React Agent"},
177
- 'XcodeAgent': {'mode': True, 'id': "Xcode Agent"},
178
- 'AngularJSAgent': {'mode': True, 'id': "AngularJS Agent"},
179
- 'HerokuAgent': {'mode': True, 'id': "HerokuAgent"},
180
- 'GodotAgent': {'mode': True, 'id': "GodotAgent"},
181
- 'GoAgent': {'mode': True, 'id': "GoAgent"},
182
- 'GitlabAgent': {'mode': True, 'id': "GitlabAgent"},
183
- 'GitAgent': {'mode': True, 'id': "GitAgent"},
184
- 'RepoMap': {'mode': True, 'id': "repomap"},
185
-
186
- # Added New Agents
187
- 'FlaskAgent': {'mode': True, 'id': "FlaskAgentTrendID"},
188
- 'FirebaseAgent': {'mode': True, 'id': "FirebaseAgentTrendID"},
189
- 'FastAPIAgent': {'mode': True, 'id': "FastAPIAgentTrendID"},
190
- 'ErlangAgent': {'mode': True, 'id': "ErlangAgentTrendID"},
191
- 'ElectronAgent': {'mode': True, 'id': "ElectronAgentTrendID"},
192
- 'DockerAgent': {'mode': True, 'id': "DockerAgentTrendID"},
193
- 'DigitalOceanAgent': {'mode': True, 'id': "DigitalOceanAgentTrendID"},
194
- 'BitbucketAgent': {'mode': True, 'id': "BitbucketAgentTrendID"},
195
- 'AzureAgent': {'mode': True, 'id': "AzureAgentTrendID"},
196
- 'FlutterAgent': {'mode': True, 'id': "FlutterAgentTrendID"},
197
- 'YoutubeAgent': {'mode': True, 'id': "YoutubeAgentTrendID"},
198
- 'builderAgent': {'mode': True, 'id': "builderAgentTrendID"},
199
- }
200
 
201
- # Model prefixes
202
- MODEL_PREFIXES = {
203
- 'gpt-4o': '@GPT-4o',
204
- 'gemini-pro': '@Gemini-PRO',
205
- 'PythonAgent': '@Python Agent',
206
- 'JavaAgent': '@Java Agent',
207
- 'JavaScriptAgent': '@JavaScript Agent',
208
- 'HTMLAgent': '@HTML Agent',
209
- 'GoogleCloudAgent': '@Google Cloud Agent',
210
- 'AndroidDeveloper': '@Android Developer',
211
- 'SwiftDeveloper': '@Swift Developer',
212
- 'Next.jsAgent': '@Next.js Agent',
213
- 'MongoDBAgent': '@MongoDB Agent',
214
- 'PyTorchAgent': '@PyTorch Agent',
215
- 'ReactAgent': '@React Agent',
216
- 'XcodeAgent': '@Xcode Agent',
217
- 'AngularJSAgent': '@AngularJS Agent',
218
- 'HerokuAgent': '@Heroku Agent',
219
- 'GodotAgent': '@Godot Agent',
220
- 'GoAgent': '@Go Agent',
221
- 'GitlabAgent': '@Gitlab Agent',
222
- 'GitAgent': '@Gitlab Agent',
223
- 'blackboxai-pro': '@BLACKBOXAI-PRO',
224
- 'flux': '@Image Generation',
225
- # Add any additional prefixes if necessary
226
-
227
- # Added New Agents
228
- 'FlaskAgent': '@Flask Agent',
229
- 'FirebaseAgent': '@Firebase Agent',
230
- 'FastAPIAgent': '@FastAPI Agent',
231
- 'ErlangAgent': '@Erlang Agent',
232
- 'ElectronAgent': '@Electron Agent',
233
- 'DockerAgent': '@Docker Agent',
234
- 'DigitalOceanAgent': '@DigitalOcean Agent',
235
- 'BitbucketAgent': '@Bitbucket Agent',
236
- 'AzureAgent': '@Azure Agent',
237
- 'FlutterAgent': '@Flutter Agent',
238
- 'YoutubeAgent': '@Youtube Agent',
239
- 'builderAgent': '@builder Agent',
240
  }
241
 
242
- # Model referers
243
- MODEL_REFERERS = {
244
- "blackboxai": "/?model=blackboxai",
245
- "gpt-4o": "/?model=gpt-4o",
246
- "gemini-pro": "/?model=gemini-pro",
247
- "claude-sonnet-3.5": "/?model=claude-sonnet-3.5",
248
- # Add any additional referers if necessary
249
- }
 
3
 
4
  load_dotenv()
5
 
6
+ # Base URL and Common Headers for Editee
7
+ BASE_URL = "https://editee.com"
8
  common_headers = {
9
+ 'accept': 'application/json, text/plain, */*',
10
  'accept-language': 'en-US,en;q=0.9',
11
  'cache-control': 'no-cache',
12
  'origin': BASE_URL,
13
  'pragma': 'no-cache',
14
  'priority': 'u=1, i',
15
+ 'sec-ch-ua': '"Chromium";v="129", "Not=A?Brand";v="8"',
16
  'sec-ch-ua-mobile': '?0',
17
+ 'sec-ch-ua-platform': '"Linux"',
18
  'sec-fetch-dest': 'empty',
19
  'sec-fetch-mode': 'cors',
20
  'sec-fetch-site': 'same-origin',
21
+ 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',
 
 
22
  }
23
 
24
+ # Header Configurations for Editee API Calls
25
  def get_headers_api_chat(referer_url):
26
  return {**common_headers, 'Content-Type': 'application/json', 'Referer': referer_url}
27
 
 
36
  'next-url': '/',
37
  }
38
 
39
+ # Application Secret for Authentication
40
  APP_SECRET = os.getenv("APP_SECRET")
41
 
42
+ # Default Model
43
+ default_model = 'claude'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
+ # Supported Models
46
+ models = ['claude', 'gpt4', 'gemini', 'mistrallarge']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
+ # Model Aliases
49
+ model_aliases = {
50
+ "claude-3.5-sonnet": "claude",
51
+ "gpt-4o": "gpt4",
52
+ "gemini-pro": "gemini",
53
+ "mistral-large": "mistrallarge",
54
  }
55
 
56
+ # Allowed Models with ID and Name
57
+ ALLOWED_MODELS = [
58
+ {"id": "claude", "name": "Claude"},
59
+ {"id": "gpt4", "name": "GPT-4"},
60
+ {"id": "gemini", "name": "Gemini"},
61
+ {"id": "mistrallarge", "name": "Mistral Large"},
62
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
+ # Mapping from model IDs to their canonical names
65
+ MODEL_MAPPING = {
66
+ "claude": "claude",
67
+ "gpt4": "gpt4",
68
+ "gemini": "gemini",
69
+ "mistrallarge": "mistrallarge",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  }
71
 
72
+ # Removed MODEL_PREFIXES, MODEL_REFERERS, and AGENT_MODE as per user instruction