Tonic commited on
Commit
0e87b70
1 Parent(s): 70358c4

Update app_template.py

Browse files
Files changed (1) hide show
  1. app_template.py +9 -7
app_template.py CHANGED
@@ -27,16 +27,18 @@ def predict_beta(message, chatbot=[], system_prompt=""):
27
  advanced,
28
  fn_index=0
29
  )
30
-
31
- if result is not None and len(result) > 0:
32
- bot_message = result[0]
33
- return bot_message
34
  else:
35
- raise gr.Error("No response received from the model.")
36
-
 
37
  except Exception as e:
38
  error_msg = f"An error occurred: {str(e)}"
39
- raise gr.Error(error_msg)
 
40
 
41
  def test_preview_chatbot(message, history):
42
  response = predict_beta(message, history, SYSTEM_PROMPT)
 
27
  advanced,
28
  fn_index=0
29
  )
30
+ print("Raw API Response:", result) # Debugging print
31
+ if result is not None:
32
+ print("Processed bot_message:", result) # Debugging print
33
+ return result
34
  else:
35
+ print("No response or empty response from the model.") # Debugging print
36
+ return None
37
+
38
  except Exception as e:
39
  error_msg = f"An error occurred: {str(e)}"
40
+ print(error_msg) # Debugging print
41
+ return None
42
 
43
  def test_preview_chatbot(message, history):
44
  response = predict_beta(message, history, SYSTEM_PROMPT)