Update main.py
Browse files
main.py
CHANGED
@@ -54,37 +54,38 @@ async def chat_completions(request: ChatRequest):
|
|
54 |
)
|
55 |
|
56 |
# Build the payload as per the required structure
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
|
|
88 |
|
89 |
logger.info(f"Outgoing API request payload: {json.dumps(json_data, indent=2)}")
|
90 |
|
|
|
54 |
)
|
55 |
|
56 |
# Build the payload as per the required structure
|
57 |
+
json_data = {
|
58 |
+
'prompt': "\n".join(
|
59 |
+
[f"{'User' if msg.role == 'user' else 'Assistant'}: {msg.content}" for msg in request.messages]
|
60 |
+
),
|
61 |
+
'stream': request.stream,
|
62 |
+
'app_name': "ChitChat_Chrome_Ext",
|
63 |
+
'app_version': "4.28.0",
|
64 |
+
'auto_search': False,
|
65 |
+
'chat_models': [request.model], # Try setting model here
|
66 |
+
'cid': "C082SLBVNR9J",
|
67 |
+
'extra_info': {
|
68 |
+
'origin_url': "chrome-extension://difoiogjjojoaoomphldepapgpbgkhkb/standalone.html?from=sidebar",
|
69 |
+
'origin_title': "Sider"
|
70 |
+
},
|
71 |
+
'files': [],
|
72 |
+
'filter_search_history': False,
|
73 |
+
'from': "chat",
|
74 |
+
'group_id': "default",
|
75 |
+
'model': request.model, # Keep original model field
|
76 |
+
'prompt_template': {
|
77 |
+
'key': "artifacts",
|
78 |
+
'attributes': {
|
79 |
+
'lang': "original"
|
80 |
+
}
|
81 |
+
},
|
82 |
+
'search': False,
|
83 |
+
'tools': {
|
84 |
+
'auto': ["search", "text_to_image", "data_analysis"]
|
85 |
+
},
|
86 |
+
'tz_name': "Asia/Karachi"
|
87 |
+
}
|
88 |
+
|
89 |
|
90 |
logger.info(f"Outgoing API request payload: {json.dumps(json_data, indent=2)}")
|
91 |
|