akiko19191 commited on
Commit
de74166
·
verified ·
1 Parent(s): 13a608a

Update utils/llms.py

Browse files
Files changed (1) hide show
  1. utils/llms.py +5 -4
utils/llms.py CHANGED
@@ -162,9 +162,10 @@ def gpt4stream(messages,model,api_keys):
162
  cunk=""
163
  for part in response:
164
  cunk=cunk+(part.choices[0].delta.content or "")
165
-
 
166
  if "```json" not in cunk:
167
- helper.q.put_nowait(part.choices[0].delta.content or "")
168
  if helper.stopped:
169
  clear()
170
  break
@@ -259,9 +260,9 @@ def gpt4stream(messages,model,api_keys):
259
  # Add any other necessary parameters
260
  )
261
  for part in response:
262
- cunk=cunk+(part.choices[0].delta.content or "")
263
  if "```json" not in cunk or "```" not in cunk:
264
- helper.q.put_nowait(part.choices[0].delta.content or "")
265
  if helper.stopped:
266
  clear()
267
  break
 
162
  cunk=""
163
  for part in response:
164
  cunk=cunk+(part.choices[0].delta.content or "")
165
+ x=part.choices[0].delta.content
166
+ x=x.replace('>','\n </think> \n ')
167
  if "```json" not in cunk:
168
+ helper.q.put_nowait(x or "")
169
  if helper.stopped:
170
  clear()
171
  break
 
260
  # Add any other necessary parameters
261
  )
262
  for part in response:
263
+ cunk=cunk+(str(part.choices[0].delta.content) or "")
264
  if "```json" not in cunk or "```" not in cunk:
265
+ helper.q.put_nowait(str(part.choices[0].delta.content) or "")
266
  if helper.stopped:
267
  clear()
268
  break