Spaces:
Running
Running
Update utils/llms.py
Browse files- utils/llms.py +5 -3
utils/llms.py
CHANGED
@@ -232,15 +232,17 @@ def gpt4stream(messages,model,api_keys):
|
|
232 |
# Add any other necessary parameters
|
233 |
)
|
234 |
for part in response:
|
235 |
-
|
|
|
236 |
if helper.stopped:
|
237 |
clear()
|
238 |
break
|
239 |
-
if "```json" not in cunk or "```" not in cunk:
|
240 |
-
helper.q.put_nowait(part.choices[0].delta.content or "")
|
241 |
break
|
242 |
except Exception as e:
|
243 |
#helper.q.put_nowait(str(e))
|
|
|
244 |
pass
|
245 |
print("STOPPING")
|
246 |
helper.q.put_nowait("RESULT: "+cunk)
|
|
|
232 |
# Add any other necessary parameters
|
233 |
)
|
234 |
for part in response:
|
235 |
+
print(part)
|
236 |
+
cunk=cunk+(str(part.choices[0].delta.content) or "")
|
237 |
if helper.stopped:
|
238 |
clear()
|
239 |
break
|
240 |
+
if ("```json" not in cunk or "```" not in cunk) and (str(part.choices[0].delta.content) != "None"):
|
241 |
+
helper.q.put_nowait(str(part.choices[0].delta.content) or "")
|
242 |
break
|
243 |
except Exception as e:
|
244 |
#helper.q.put_nowait(str(e))
|
245 |
+
print(e)
|
246 |
pass
|
247 |
print("STOPPING")
|
248 |
helper.q.put_nowait("RESULT: "+cunk)
|