nanova commited on
Commit
8709f65
·
1 Parent(s): ed9d3e7
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -69,8 +69,17 @@ def respond(
69
  if 'choices' in json_response and len(json_response['choices']) > 0:
70
  response = json_response['choices'][0].get('message', {}).get('content', '')
71
  if response:
 
72
  return response
73
- return "Service temporarily unavailable"
 
 
 
 
 
 
 
 
74
  except Exception as e:
75
  print(f"[ERROR] Request error: {e}")
76
  return "Service error occurred"
 
69
  if 'choices' in json_response and len(json_response['choices']) > 0:
70
  response = json_response['choices'][0].get('message', {}).get('content', '')
71
  if response:
72
+ print(f"[INFO] API response content: {response}")
73
  return response
74
+ else:
75
+ print("[ERROR] No content found in API response")
76
+ return "No content in the response"
77
+ else:
78
+ print("[ERROR] No choices found in API response")
79
+ return "No choices in the response"
80
+ else:
81
+ print(f"[ERROR] Unexpected status code: {r.status_code}")
82
+ return "Unexpected status code from API"
83
  except Exception as e:
84
  print(f"[ERROR] Request error: {e}")
85
  return "Service error occurred"