SamiKoen commited on
Commit
253e59a
·
verified ·
1 Parent(s): 9a4d457

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
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
- if response.status_code != 200:
806
- yield "Bir hata oluştu."
807
- return
 
 
 
 
 
 
 
 
 
 
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