Update main.py
Browse files
main.py
CHANGED
@@ -162,45 +162,46 @@ async def chat_completions(
|
|
162 |
original_uuid = uuid.uuid4()
|
163 |
uuid_str = str(original_uuid).replace("-", "")
|
164 |
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
'
|
187 |
-
|
188 |
-
'
|
189 |
-
'lang': 'original',
|
190 |
-
},
|
191 |
},
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
}
|
|
|
|
|
|
|
204 |
|
205 |
async def generate():
|
206 |
async with httpx.AsyncClient() as client:
|
|
|
162 |
original_uuid = uuid.uuid4()
|
163 |
uuid_str = str(original_uuid).replace("-", "")
|
164 |
|
165 |
+
json_data = {
|
166 |
+
'prompt': "\n".join(
|
167 |
+
[
|
168 |
+
f"{'User' if msg.role == 'user' else 'Assistant'}: {msg.content}"
|
169 |
+
for msg in request.messages
|
170 |
+
]
|
171 |
+
),
|
172 |
+
'stream': True,
|
173 |
+
'app_name': 'ChitChat_Edge_Ext',
|
174 |
+
'app_version': '4.28.0',
|
175 |
+
'tz_name': 'Asia/Karachi',
|
176 |
+
'cid': 'C092SEMXM9BJ',
|
177 |
+
'model': request.model,
|
178 |
+
'search': False, # Ensure search is disabled
|
179 |
+
'auto_search': False, # Ensure auto_search is disabled
|
180 |
+
'filter_search_history': False,
|
181 |
+
'from': 'chat',
|
182 |
+
'group_id': 'default',
|
183 |
+
'chat_models': [],
|
184 |
+
'files': [],
|
185 |
+
'prompt_template': {
|
186 |
+
'key': '',
|
187 |
+
'attributes': {
|
188 |
+
'lang': 'original',
|
|
|
|
|
189 |
},
|
190 |
+
},
|
191 |
+
'tools': {
|
192 |
+
'auto': [
|
193 |
+
'text_to_image',
|
194 |
+
'data_analysis',
|
195 |
+
# Removed 'search' from the list
|
196 |
+
],
|
197 |
+
},
|
198 |
+
'extra_info': {
|
199 |
+
'origin_url': '',
|
200 |
+
'origin_title': '',
|
201 |
+
},
|
202 |
+
}
|
203 |
+
|
204 |
+
|
205 |
|
206 |
async def generate():
|
207 |
async with httpx.AsyncClient() as client:
|