Niansuh commited on
Commit
c5d3cb8
·
verified ·
1 Parent(s): ec6c0db

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +20 -18
main.py CHANGED
@@ -164,30 +164,31 @@ 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
- '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,
181
- 'from': 'chat',
182
- 'group_id': 'default',
183
- 'prompt_template': {
 
184
  'key': 'artifacts',
185
  'attributes': {
186
  'lang': 'original',
187
  },
188
  },
189
  'tools': {
190
- 'auto': ['search', 'text_to_image', 'data_analysis'],
191
  },
192
  'extra_info': {
193
  'origin_url': 'chrome-extension://difoiogjjojoaoomphldepapgpbgkhkb/standalone.html?from=sidebar',
@@ -195,6 +196,7 @@ async def chat_completions(
195
  },
196
  }
197
 
 
198
  async def generate():
199
  async with httpx.AsyncClient() as client:
200
  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',
 
196
  },
197
  }
198
 
199
+
200
  async def generate():
201
  async with httpx.AsyncClient() as client:
202
  try: