Update api/config.py
Browse files- api/config.py +84 -31
api/config.py
CHANGED
@@ -3,27 +3,28 @@ from dotenv import load_dotenv
|
|
3 |
|
4 |
load_dotenv()
|
5 |
|
6 |
-
# Base URL and Common Headers for
|
7 |
-
BASE_URL = "https://
|
8 |
common_headers = {
|
9 |
-
'
|
10 |
-
'
|
11 |
-
'
|
12 |
-
'
|
13 |
-
'
|
14 |
-
'
|
15 |
-
'
|
|
|
|
|
|
|
|
|
|
|
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
|
25 |
def get_headers_api_chat(referer_url):
|
26 |
-
return {**common_headers, '
|
27 |
|
28 |
def get_headers_chat(chat_url, next_action, next_router_state_tree):
|
29 |
return {
|
@@ -40,33 +41,85 @@ def get_headers_chat(chat_url, next_action, next_router_state_tree):
|
|
40 |
APP_SECRET = os.getenv("APP_SECRET")
|
41 |
|
42 |
# Default Model
|
43 |
-
default_model = '
|
44 |
|
45 |
-
# Supported Models
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
# Model Aliases
|
49 |
model_aliases = {
|
50 |
-
|
51 |
-
"
|
52 |
-
"gemini-pro": "gemini",
|
53 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
|
56 |
# Allowed Models with ID and Name
|
57 |
ALLOWED_MODELS = [
|
58 |
-
{"id": "
|
59 |
-
{"id": "
|
60 |
-
{"id": "
|
61 |
-
{"id": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
]
|
63 |
|
64 |
# Mapping from model IDs to their canonical names
|
65 |
MODEL_MAPPING = {
|
66 |
-
"
|
67 |
-
"
|
68 |
-
"
|
69 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
|
72 |
# Removed MODEL_PREFIXES, MODEL_REFERERS, and AGENT_MODE as per user instruction
|
|
|
3 |
|
4 |
load_dotenv()
|
5 |
|
6 |
+
# Base URL and Common Headers for GizAI
|
7 |
+
BASE_URL = "https://app.giz.ai/assistant/"
|
8 |
common_headers = {
|
9 |
+
'Accept': 'application/json, text/plain, */*',
|
10 |
+
'Accept-Language': 'en-US,en;q=0.9',
|
11 |
+
'Cache-Control': 'no-cache',
|
12 |
+
'Connection': 'keep-alive',
|
13 |
+
'Content-Type': 'application/json',
|
14 |
+
'Origin': 'https://app.giz.ai',
|
15 |
+
'Pragma': 'no-cache',
|
16 |
+
'Sec-Fetch-Dest': 'empty',
|
17 |
+
'Sec-Fetch-Mode': 'cors',
|
18 |
+
'Sec-Fetch-Site': 'same-origin',
|
19 |
+
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36',
|
20 |
+
'sec-ch-ua': '"Not?A_Brand";v="99", "Chromium";v="130"',
|
21 |
'sec-ch-ua-mobile': '?0',
|
22 |
+
'sec-ch-ua-platform': '"Linux"'
|
|
|
|
|
|
|
|
|
23 |
}
|
24 |
|
25 |
+
# Header Configurations for GizAI API Calls
|
26 |
def get_headers_api_chat(referer_url):
|
27 |
+
return {**common_headers, 'Referer': referer_url}
|
28 |
|
29 |
def get_headers_chat(chat_url, next_action, next_router_state_tree):
|
30 |
return {
|
|
|
41 |
APP_SECRET = os.getenv("APP_SECRET")
|
42 |
|
43 |
# Default Model
|
44 |
+
default_model = 'chat-gemini-flash'
|
45 |
|
46 |
+
# Supported Chat Models
|
47 |
+
chat_models = [
|
48 |
+
'chat-gemini-flash',
|
49 |
+
'chat-gemini-pro',
|
50 |
+
'chat-gpt4m',
|
51 |
+
'chat-gpt4',
|
52 |
+
'claude-sonnet',
|
53 |
+
'claude-haiku',
|
54 |
+
'llama-3-70b',
|
55 |
+
'llama-3-8b',
|
56 |
+
'mistral-large',
|
57 |
+
'chat-o1-mini'
|
58 |
+
]
|
59 |
+
|
60 |
+
# Supported Image Models
|
61 |
+
image_models = [
|
62 |
+
'flux1',
|
63 |
+
'sdxl',
|
64 |
+
'sd',
|
65 |
+
'sd35',
|
66 |
+
]
|
67 |
+
|
68 |
+
# Combined Models List
|
69 |
+
models = [*chat_models, *image_models]
|
70 |
|
71 |
# Model Aliases
|
72 |
model_aliases = {
|
73 |
+
# Chat model aliases
|
74 |
+
"gemini-flash": "chat-gemini-flash",
|
75 |
+
"gemini-pro": "chat-gemini-pro",
|
76 |
+
"gpt-4o-mini": "chat-gpt4m",
|
77 |
+
"gpt-4o": "chat-gpt4",
|
78 |
+
"claude-3.5-sonnet": "claude-sonnet",
|
79 |
+
"claude-3-haiku": "claude-haiku",
|
80 |
+
"llama-3.1-70b": "llama-3-70b",
|
81 |
+
"llama-3.1-8b": "llama-3-8b",
|
82 |
+
"o1-mini": "chat-o1-mini",
|
83 |
+
# Image model aliases
|
84 |
+
"sd-1.5": "sd",
|
85 |
+
"sd-3.5": "sd35",
|
86 |
+
"flux-schnell": "flux1",
|
87 |
}
|
88 |
|
89 |
# Allowed Models with ID and Name
|
90 |
ALLOWED_MODELS = [
|
91 |
+
{"id": "chat-gemini-flash", "name": "Chat Gemini Flash"},
|
92 |
+
{"id": "chat-gemini-pro", "name": "Chat Gemini Pro"},
|
93 |
+
{"id": "chat-gpt4m", "name": "Chat GPT-4m"},
|
94 |
+
{"id": "chat-gpt4", "name": "Chat GPT-4"},
|
95 |
+
{"id": "claude-sonnet", "name": "Claude Sonnet"},
|
96 |
+
{"id": "claude-haiku", "name": "Claude Haiku"},
|
97 |
+
{"id": "llama-3-70b", "name": "LLaMA 3-70B"},
|
98 |
+
{"id": "llama-3-8b", "name": "LLaMA 3-8B"},
|
99 |
+
{"id": "mistral-large", "name": "Mistral Large"},
|
100 |
+
{"id": "chat-o1-mini", "name": "Chat O1 Mini"},
|
101 |
+
{"id": "flux1", "name": "Flux1"},
|
102 |
+
{"id": "sdxl", "name": "SDXL"},
|
103 |
+
{"id": "sd", "name": "SD"},
|
104 |
+
{"id": "sd35", "name": "SD35"},
|
105 |
]
|
106 |
|
107 |
# Mapping from model IDs to their canonical names
|
108 |
MODEL_MAPPING = {
|
109 |
+
"chat-gemini-flash": "chat-gemini-flash",
|
110 |
+
"chat-gemini-pro": "chat-gemini-pro",
|
111 |
+
"chat-gpt4m": "chat-gpt4m",
|
112 |
+
"chat-gpt4": "chat-gpt4",
|
113 |
+
"claude-sonnet": "claude-sonnet",
|
114 |
+
"claude-haiku": "claude-haiku",
|
115 |
+
"llama-3-70b": "llama-3-70b",
|
116 |
+
"llama-3-8b": "llama-3-8b",
|
117 |
+
"mistral-large": "mistral-large",
|
118 |
+
"chat-o1-mini": "chat-o1-mini",
|
119 |
+
"flux1": "flux1",
|
120 |
+
"sdxl": "sdxl",
|
121 |
+
"sd": "sd",
|
122 |
+
"sd35": "sd35",
|
123 |
}
|
124 |
|
125 |
# Removed MODEL_PREFIXES, MODEL_REFERERS, and AGENT_MODE as per user instruction
|