Spaces:
Running
Running
jonathanjordan21
commited on
Commit
•
a673ddb
1
Parent(s):
4070db8
Update apis/chat_api.py
Browse files- apis/chat_api.py +4 -1
apis/chat_api.py
CHANGED
@@ -225,13 +225,16 @@ class ChatAPIApp:
|
|
225 |
)
|
226 |
|
227 |
import json
|
228 |
-
event_source_response
|
|
|
|
|
229 |
event_source_response = {
|
230 |
"model": event_source_response.get('model'),
|
231 |
"created_at": event_source_response.get('created_at'),
|
232 |
"response": event_source_response.get('choices')[-1].get('delta').get('content'),
|
233 |
"done": True if event_source_response.get('choices')[-1].get('finish_reason') != None else False,
|
234 |
}
|
|
|
235 |
|
236 |
return event_source_response
|
237 |
else:
|
|
|
225 |
)
|
226 |
|
227 |
import json
|
228 |
+
print(event_source_response, "EVENT RESPONSE FIRST")
|
229 |
+
event_source_response = json.loads(str(event_source_response).split('data: ')[-1])
|
230 |
+
print(event_source_response, "EVENT RESPONSE SECOND")
|
231 |
event_source_response = {
|
232 |
"model": event_source_response.get('model'),
|
233 |
"created_at": event_source_response.get('created_at'),
|
234 |
"response": event_source_response.get('choices')[-1].get('delta').get('content'),
|
235 |
"done": True if event_source_response.get('choices')[-1].get('finish_reason') != None else False,
|
236 |
}
|
237 |
+
print(event_source_response, "EVENT RESPONSE THIRD")
|
238 |
|
239 |
return event_source_response
|
240 |
else:
|