Update main.py
Browse files
main.py
CHANGED
|
@@ -164,39 +164,40 @@ async def chat_completions(
|
|
| 164 |
original_uuid = uuid.uuid4()
|
| 165 |
uuid_str = str(original_uuid).replace("-", "")
|
| 166 |
|
| 167 |
-
# Using the OpenAI API
|
| 168 |
-
json_data = {
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
),
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
'key': 'artifacts',
|
| 186 |
'attributes': {
|
| 187 |
'lang': 'original',
|
| 188 |
},
|
| 189 |
},
|
| 190 |
-
|
| 191 |
-
|
| 192 |
},
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
},
|
| 197 |
}
|
| 198 |
|
| 199 |
|
|
|
|
| 200 |
async def generate():
|
| 201 |
async with httpx.AsyncClient() as client:
|
| 202 |
try:
|
|
|
|
| 164 |
original_uuid = uuid.uuid4()
|
| 165 |
uuid_str = str(original_uuid).replace("-", "")
|
| 166 |
|
| 167 |
+
# Using the OpenAI API
|
| 168 |
+
json_data = {
|
| 169 |
+
'prompt': "\n".join(
|
| 170 |
+
[
|
| 171 |
+
f"{'User' if msg.role == 'user' else 'Assistant'}: {msg.content}"
|
| 172 |
+
for msg in request.messages
|
| 173 |
+
]
|
| 174 |
),
|
| 175 |
+
'stream': True,
|
| 176 |
+
'app_name': 'ChitChat_Edge_Ext',
|
| 177 |
+
'app_version': '4.28.0',
|
| 178 |
+
'tz_name': 'Asia/Karachi',
|
| 179 |
+
'model': request.model,
|
| 180 |
+
'search': False, # Explicitly turn off search
|
| 181 |
+
'auto_search': False, # Turn off auto-search
|
| 182 |
+
'from': 'chat',
|
| 183 |
+
'group_id': 'default',
|
| 184 |
+
'prompt_template': {
|
| 185 |
'key': 'artifacts',
|
| 186 |
'attributes': {
|
| 187 |
'lang': 'original',
|
| 188 |
},
|
| 189 |
},
|
| 190 |
+
'tools': {
|
| 191 |
+
'auto': ['text_to_image', 'data_analysis'], # Remove 'search' from tools if not needed
|
| 192 |
},
|
| 193 |
+
'extra_info': {
|
| 194 |
+
'origin_url': 'chrome-extension://difoiogjjojoaoomphldepapgpbgkhkb/standalone.html?from=sidebar',
|
| 195 |
+
'origin_title': 'Sider',
|
| 196 |
},
|
| 197 |
}
|
| 198 |
|
| 199 |
|
| 200 |
+
|
| 201 |
async def generate():
|
| 202 |
async with httpx.AsyncClient() as client:
|
| 203 |
try:
|