Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -42,10 +42,10 @@ def chat_completions():
|
|
42 |
|
43 |
try:
|
44 |
response = closeai.ChatCompletion.create(model=model, stream=streaming, messages=messages)
|
45 |
-
except Exception as
|
46 |
-
print(
|
47 |
def errorStream():
|
48 |
-
yield 'data: %s\n\n' % json.dumps({"status":"!=200","error":str(
|
49 |
return app.response_class(errorStream(), mimetype='text/event-stream')
|
50 |
if not streaming:
|
51 |
|
|
|
42 |
|
43 |
try:
|
44 |
response = closeai.ChatCompletion.create(model=model, stream=streaming, messages=messages)
|
45 |
+
except Exception as er:
|
46 |
+
print(er)
|
47 |
def errorStream():
|
48 |
+
yield 'data: %s\n\n' % json.dumps({"status":"!=200","error":str(er)}, separators=(',' ':'))
|
49 |
return app.response_class(errorStream(), mimetype='text/event-stream')
|
50 |
if not streaming:
|
51 |
|