Spaces:
Sleeping
Sleeping
Update app.py
Browse files1609 unmodified lines161016111612161316141613161416151616161616171617161816191620162116221623162416251619162016261627162816221623162916301631163216334 unmodified lines163816391640164116421643164455 unmodified lines170017011702169517031704170517061707170817091710171117121609 unmodified lines global df_builder_pivot_str
try: # Get the current value of selected_dataset_ai selected_dataset_ai = read_ai_dataset_selection() # Recompute DATAFRAME_PROOF_POINT based on the updated selected dataset if selected_dataset_ai is None: selected_dataset_ai = read_ai_dataset_selection()
# Recompute DATAFRAME_PROOF_POINT based on the selected dataset df_builder_pivot_str = compute_dataframe_proof_point() df_builder_pivot_str = compute_dataframe_proof_point(selected_dataset_ai)
# Check if DATAFRAME_PROOF_POINT is computed correctly if not df_builder_pivot_str: # Fall back to general knowledge if DATAFRAME_PROOF_POINT is empty response = ( "Trust Builder information is not given, I will reply based on general knowledge." ) else: # Generate response using the agent executor output = agent_executor.invoke({"input": message, "chat_history": chat_history}) # Generate response using the agent executor output = agent_executor.invoke({"input": message, "chat_history": chat_history})
# Prepend the selected dataset to the response response = f"**Selected Dataset: {selected_dataset_ai}**\n\n{output['output']}" # Prepend the selected dataset to the response response = f"**Selected Dataset: {selected_dataset_ai}**\n\n{output['output']}"
# Save the interaction context chat_history.extend(4 unmodified lines )
return response
except Exception as e: logger.error(f"Error generating chatbot response: {e}") return "Error occurred during response generation"55 unmodified lines return plot_to_svg(fig2)
def update_ai_dataset_selection(selection): global selected_dataset_ai selected_dataset_ai = selection
# Recompute DATAFRAME_PROOF_POINT after updating the dataset compute_dataframe_proof_point(selected_dataset_ai)
return selection
app.py+20-9