Niansuh commited on
Commit
b297abf
·
verified ·
1 Parent(s): 42a12ac

Update api/config.py

Browse files
Files changed (1) hide show
  1. 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
- # Headers Configuration (Updated to use new headers)
10
- def get_headers():
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': f"{BASE_URL}",
17
  'pragma': 'no-cache',
18
  'priority': 'u=1, i',
19
- 'referer': f"{BASE_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,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": "PythonAgent", "name": "PythonAgent"},
45
- {"id": "JavaAgent", "name": "JavaAgent"},
46
- {"id": "JavaScriptAgent", "name": "JavaScriptAgent"},
47
- {"id": "HTMLAgent", "name": "HTMLAgent"},
48
- {"id": "GoogleCloudAgent", "name": "GoogleCloudAgent"},
49
- {"id": "AndroidDeveloper", "name": "AndroidDeveloper"},
50
- {"id": "SwiftDeveloper", "name": "SwiftDeveloper"},
51
- {"id": "Next.jsAgent", "name": "Next.jsAgent"},
52
- {"id": "MongoDBAgent", "name": "MongoDBAgent"},
53
- {"id": "PyTorchAgent", "name": "PyTorchAgent"},
54
- {"id": "ReactAgent", "name": "ReactAgent"},
55
- {"id": "XcodeAgent", "name": "XcodeAgent"},
56
- {"id": "AngularJSAgent", "name": "AngularJSAgent"},
57
- {"id": "HerokuAgent", "name": "HerokuAgent"},
58
- {"id": "GodotAgent", "name": "GodotAgent"},
59
- {"id": "GoAgent", "name": "GoAgent"},
60
- {"id": "GitlabAgent", "name": "GitlabAgent"},
61
- {"id": "GitAgent", "name": "GitAgent"},
62
- {"id": "RepoMap", "name": "RepoMap"},
63
- {"id": "gemini-1.5-pro-latest", "name": "gemini-pro"},
64
- {"id": "gemini-1.5-pro", "name": "gemini-1.5-pro"},
65
- {"id": "claude-3-5-sonnet-20240620", "name": "claude-sonnet-3.5"},
66
- {"id": "claude-3-5-sonnet", "name": "claude-sonnet-3.5"},
67
- {"id": "Niansuh", "name": "Niansuh"},
68
- {"id": "o1-preview", "name": "o1-preview"},
69
-
70
- # Added New Agents
71
- {"id": "FlaskAgent", "name": "FlaskAgent"},
72
- {"id": "FirebaseAgent", "name": "FirebaseAgent"},
73
- {"id": "FastAPIAgent", "name": "FastAPIAgent"},
74
- {"id": "ErlangAgent", "name": "ErlangAgent"},
75
- {"id": "ElectronAgent", "name": "ElectronAgent"},
76
- {"id": "DockerAgent", "name": "DockerAgent"},
77
- {"id": "DigitalOceanAgent", "name": "DigitalOceanAgent"},
78
- {"id": "BitbucketAgent", "name": "BitbucketAgent"},
79
- {"id": "AzureAgent", "name": "AzureAgent"},
80
- {"id": "FlutterAgent", "name": "FlutterAgent"},
81
- {"id": "YoutubeAgent", "name": "YoutubeAgent"},
82
- {"id": "builderAgent", "name": "builderAgent"},
83
  ]
84
 
85
- MODEL_MAPPING = {
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
- 'flux': {'mode': True, 'id': "ImageGenerationLV45LJp", 'name': "flux"},
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
- 'llama-3.1-70b': {'mode': True, 'id': "llama-3.1-70b"},
153
- 'llama-3.1-405b': {'mode': True, 'id': "llama-3.1-405"},
154
- 'blackboxai-pro': {'mode': True, 'id': "BLACKBOXAI-PRO"},
155
- 'PythonAgent': {'mode': True, 'id': "Python Agent"},
156
- 'JavaAgent': {'mode': True, 'id': "Java Agent"},
157
- 'JavaScriptAgent': {'mode': True, 'id': "JavaScript Agent"},
158
- 'HTMLAgent': {'mode': True, 'id': "HTML Agent"},
159
- 'GoogleCloudAgent': {'mode': True, 'id': "Google Cloud Agent"},
160
- 'AndroidDeveloper': {'mode': True, 'id': "Android Developer"},
161
- 'SwiftDeveloper': {'mode': True, 'id': "Swift Developer"},
162
- 'Next.jsAgent': {'mode': True, 'id': "Next.js Agent"},
163
- 'MongoDBAgent': {'mode': True, 'id': "MongoDB Agent"},
164
- 'PyTorchAgent': {'mode': True, 'id': "PyTorch Agent"},
165
- 'ReactAgent': {'mode': True, 'id': "React Agent"},
166
- 'XcodeAgent': {'mode': True, 'id': "Xcode Agent"},
167
- 'AngularJSAgent': {'mode': True, 'id': "AngularJS Agent"},
168
- 'HerokuAgent': {'mode': True, 'id': "Heroku Agent"},
169
- 'GodotAgent': {'mode': True, 'id': "Godot Agent"},
170
- 'GoAgent': {'mode': True, 'id': "Go Agent"},
171
- 'GitlabAgent': {'mode': True, 'id': "Gitlab Agent"},
172
- 'GitAgent': {'mode': True, 'id': "Git Agent"},
173
- 'RepoMap': {'mode': True, 'id': "repomap"},
174
-
175
- # Added New Agents
176
- 'FlaskAgent': {'mode': True, 'id': "Flask Agent"},
177
- 'FirebaseAgent': {'mode': True, 'id': "Firebase Agent"},
178
- 'FastAPIAgent': {'mode': True, 'id': "FastAPI Agent"},
179
- 'ErlangAgent': {'mode': True, 'id': "Erlang Agent"},
180
- 'ElectronAgent': {'mode': True, 'id': "Electron Agent"},
181
- 'DockerAgent': {'mode': True, 'id': "Docker Agent"},
182
- 'DigitalOceanAgent': {'mode': True, 'id': "DigitalOcean Agent"},
183
- 'BitbucketAgent': {'mode': True, 'id': "Bitbucket Agent"},
184
- 'AzureAgent': {'mode': True, 'id': "Azure Agent"},
185
- 'FlutterAgent': {'mode': True, 'id': "Flutter Agent"},
186
- 'YoutubeAgent': {'mode': True, 'id': "Youtube Agent"},
187
- 'builderAgent': {'mode': True, 'id': "builder Agent"},
188
  }
189
 
190
- # Removed MODEL_PREFIXES and MODEL_REFERERS as per your request
 
 
 
 
 
 
 
 
 
 
 
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
+ }