Spaces:
Running
Running
fix default reason
#7
by
Chenyuwen
- opened
app.py
CHANGED
@@ -107,7 +107,7 @@ def completion():
|
|
107 |
}, headers={"Authorization": f"Bearer {st.secrets['token']}"})
|
108 |
answer = resp.json()
|
109 |
for idx, choice in enumerate(answer['choices']):
|
110 |
-
if choice.get("finish_reason",
|
111 |
st.error(f'ηζη»ζ#{idx}εΊι: {choice["finish_reason"]}')
|
112 |
elif choice.get("text", None) is None:
|
113 |
st.error(f'ηζη»ζ#{idx}εΊι: ζ ηζη»ζ')
|
|
|
107 |
}, headers={"Authorization": f"Bearer {st.secrets['token']}"})
|
108 |
answer = resp.json()
|
109 |
for idx, choice in enumerate(answer['choices']):
|
110 |
+
if choice.get("finish_reason", None) != "finished":
|
111 |
st.error(f'ηζη»ζ#{idx}εΊι: {choice["finish_reason"]}')
|
112 |
elif choice.get("text", None) is None:
|
113 |
st.error(f'ηζη»ζ#{idx}εΊι: ζ ηζη»ζ')
|