Update api/config.py
Browse files- api/config.py +32 -132
api/config.py
CHANGED
@@ -3,142 +3,42 @@ from dotenv import load_dotenv
|
|
3 |
|
4 |
load_dotenv()
|
5 |
|
6 |
-
# Base URL
|
7 |
-
BASE_URL = "https://
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
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": "
|
46 |
-
{"id": "
|
47 |
-
{"id": "gemini
|
48 |
-
{"id": "
|
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 |
-
|
91 |
-
|
92 |
-
|
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 |
}
|
|
|
3 |
|
4 |
load_dotenv()
|
5 |
|
6 |
+
# Base URL and Common Headers
|
7 |
+
BASE_URL = "https://editee.com"
|
8 |
+
EDITEA_API_ENDPOINT = "https://editee.com/submit/chatgptfree"
|
9 |
+
|
10 |
+
# Editee API Headers
|
11 |
+
EDITEA_HEADERS = {
|
12 |
+
"Accept": "application/json, text/plain, */*",
|
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": f"{BASE_URL}/chat-gpt",
|
20 |
+
"Sec-CH-UA": '"Chromium";v="129", "Not=A?Brand";v="8"',
|
21 |
+
"Sec-CH-UA-Mobile": '?0',
|
22 |
+
"Sec-CH-UA-Platform": '"Linux"',
|
23 |
+
"Sec-Fetch-Dest": 'empty',
|
24 |
+
"Sec-Fetch-Mode": 'cors',
|
25 |
+
"Sec-Fetch-Site": 'same-origin',
|
26 |
+
"User-Agent": 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',
|
27 |
+
"X-Requested-With": 'XMLHttpRequest',
|
28 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
APP_SECRET = os.getenv("APP_SECRET")
|
31 |
|
|
|
32 |
ALLOWED_MODELS = [
|
33 |
+
{"id": "claude", "name": "Claude"},
|
34 |
+
{"id": "gpt4", "name": "GPT-4"},
|
35 |
+
{"id": "gemini", "name": "Gemini"},
|
36 |
+
{"id": "mistrallarge", "name": "Mistral Large"},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
]
|
38 |
|
39 |
+
MODEL_MAPPING = {
|
40 |
+
"claude-3.5-sonnet": "claude",
|
41 |
+
"gpt-4o": "gpt4",
|
42 |
+
"gemini-pro": "gemini",
|
43 |
+
"mistral-large": "mistrallarge",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|