Niansuh commited on
Commit
6baac50
·
verified ·
1 Parent(s): af14693

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +32 -31
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
- 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': [],
66
- 'cid': "C082SLBVNR9J", # Adjust based on specific requirements if needed
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,
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
  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