Update app.py
Browse files
app.py
CHANGED
|
@@ -802,9 +802,19 @@ def chatbot_fn(user_message, history, image=None):
|
|
| 802 |
}
|
| 803 |
|
| 804 |
response = requests.post(API_URL, headers=headers, json=payload, stream=True)
|
| 805 |
-
|
| 806 |
-
|
| 807 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 808 |
|
| 809 |
partial_response = ""
|
| 810 |
|
|
|
|
| 802 |
}
|
| 803 |
|
| 804 |
response = requests.post(API_URL, headers=headers, json=payload, stream=True)
|
| 805 |
+
|
| 806 |
+
# HATA VARSA DETAYI GÖSTER
|
| 807 |
+
if response.status_code != 200:
|
| 808 |
+
try:
|
| 809 |
+
print("\n\n🔴 OPENAI API ERROR")
|
| 810 |
+
print("Status Code:", response.status_code)
|
| 811 |
+
print("Response Body:", response.text, "\n\n")
|
| 812 |
+
except Exception as e:
|
| 813 |
+
print("Error printing OpenAI error:", e)
|
| 814 |
+
|
| 815 |
+
yield f"API hatası: {response.status_code}\n{response.text}"
|
| 816 |
+
return
|
| 817 |
+
|
| 818 |
|
| 819 |
partial_response = ""
|
| 820 |
|