Update api/config.py
Browse files- api/config.py +5 -25
api/config.py
CHANGED
|
@@ -3,14 +3,12 @@ from dotenv import load_dotenv
|
|
| 3 |
|
| 4 |
load_dotenv()
|
| 5 |
|
| 6 |
-
# Base URL and Common Headers
|
| 7 |
BASE_URL = "https://www.blackbox.ai"
|
| 8 |
-
|
| 9 |
'accept': '*/*',
|
| 10 |
-
'accept-language': '
|
| 11 |
-
'
|
| 12 |
-
'origin':
|
| 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',
|
|
@@ -18,26 +16,8 @@ common_headers = {
|
|
| 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 |
-
|
| 30 |
-
def get_headers_chat(chat_url, next_action, next_router_state_tree):
|
| 31 |
-
return {
|
| 32 |
-
**common_headers,
|
| 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 |
ALLOWED_MODELS = [
|
|
|
|
| 3 |
|
| 4 |
load_dotenv()
|
| 5 |
|
|
|
|
| 6 |
BASE_URL = "https://www.blackbox.ai"
|
| 7 |
+
headers = {
|
| 8 |
'accept': '*/*',
|
| 9 |
+
'accept-language': 'zh-CN,zh;q=0.9',
|
| 10 |
+
'content-type': 'application/json',
|
| 11 |
+
'origin': 'https://www.blackbox.ai',
|
|
|
|
| 12 |
'priority': 'u=1, i',
|
| 13 |
'sec-ch-ua': '"Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"',
|
| 14 |
'sec-ch-ua-mobile': '?0',
|
|
|
|
| 16 |
'sec-fetch-dest': 'empty',
|
| 17 |
'sec-fetch-mode': 'cors',
|
| 18 |
'sec-fetch-site': 'same-origin',
|
| 19 |
+
'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',
|
|
|
|
|
|
|
| 20 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
APP_SECRET = os.getenv("APP_SECRET")
|
| 22 |
|
| 23 |
ALLOWED_MODELS = [
|