Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -673,6 +673,7 @@ def answer_question_thread(user_question, chatbot,audio=None):
|
|
| 673 |
|
| 674 |
global iterations
|
| 675 |
iterations = 0
|
|
|
|
| 676 |
# Ensure the temporary chart directory exists
|
| 677 |
# ensure_temp_chart_dir()
|
| 678 |
# Clean the /tmp/gradio/ directory
|
|
@@ -705,7 +706,8 @@ def answer_question_thread(user_question, chatbot,audio=None):
|
|
| 705 |
while iterations < max_iterations:
|
| 706 |
|
| 707 |
response = agent_executor.invoke({"input": user_question}, config={"callbacks": [langfuse_handler]}, early_stopping_method="generate")
|
| 708 |
-
|
|
|
|
| 709 |
|
| 710 |
#create_file_HF()
|
| 711 |
if isinstance(response, dict):
|
|
@@ -769,6 +771,7 @@ def answer_question_thread(user_question, chatbot,audio=None):
|
|
| 769 |
else:
|
| 770 |
if("max iterations" in response_text):
|
| 771 |
print("max iterations error in 2")
|
|
|
|
| 772 |
if agent_executor.history:
|
| 773 |
print(agent_executor.history[-1])
|
| 774 |
return user_question, response_text
|
|
|
|
| 673 |
|
| 674 |
global iterations
|
| 675 |
iterations = 0
|
| 676 |
+
agent_responses = []
|
| 677 |
# Ensure the temporary chart directory exists
|
| 678 |
# ensure_temp_chart_dir()
|
| 679 |
# Clean the /tmp/gradio/ directory
|
|
|
|
| 706 |
while iterations < max_iterations:
|
| 707 |
|
| 708 |
response = agent_executor.invoke({"input": user_question}, config={"callbacks": [langfuse_handler]}, early_stopping_method="generate")
|
| 709 |
+
# Track the response
|
| 710 |
+
agent_responses.append(agent_output)
|
| 711 |
|
| 712 |
#create_file_HF()
|
| 713 |
if isinstance(response, dict):
|
|
|
|
| 771 |
else:
|
| 772 |
if("max iterations" in response_text):
|
| 773 |
print("max iterations error in 2")
|
| 774 |
+
print(agent_responses[-1])
|
| 775 |
if agent_executor.history:
|
| 776 |
print(agent_executor.history[-1])
|
| 777 |
return user_question, response_text
|