Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -422,8 +422,16 @@ def chat_fn(user_text, audio_file, settings, chat_history):
|
|
| 422 |
final_emotion_tag = emotion_tag if emotion_tag != "None" else None
|
| 423 |
final_topic_tag = topic_tag if topic_tag != "None" else None
|
| 424 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
simple_history = chat_history[:-1]
|
| 426 |
-
response = answer_query(chain, question, chat_history=simple_history, scenario_tag=final_scenario_tag, emotion_tag=final_emotion_tag, topic_tag=final_topic_tag)
|
|
|
|
|
|
|
|
|
|
| 427 |
|
| 428 |
answer = response.get("answer", "[No answer found]")
|
| 429 |
chat_history.append({"role": "assistant", "content": answer})
|
|
|
|
| 422 |
final_emotion_tag = emotion_tag if emotion_tag != "None" else None
|
| 423 |
final_topic_tag = topic_tag if topic_tag != "None" else None
|
| 424 |
|
| 425 |
+
# --- ADD the line below it ---
|
| 426 |
+
# The NLU returns a list, so we'll pass the whole list to the agent for context tag
|
| 427 |
+
final_context_tags = detected_tags.get("detected_contexts", []) if (manual_behavior_tag == "None" and manual_emotion_tag == "None" and manual_topic_tag == "None") else []
|
| 428 |
+
|
| 429 |
+
|
| 430 |
simple_history = chat_history[:-1]
|
| 431 |
+
# response = answer_query(chain, question, chat_history=simple_history, scenario_tag=final_scenario_tag, emotion_tag=final_emotion_tag, topic_tag=final_topic_tag)
|
| 432 |
+
# Corrected call: for adding context tag
|
| 433 |
+
response = answer_query(chain, question, chat_history=simple_history, scenario_tag=final_scenario_tag, emotion_tag=final_emotion_tag, topic_tag=final_topic_tag, context_tags=final_context_tags)
|
| 434 |
+
|
| 435 |
|
| 436 |
answer = response.get("answer", "[No answer found]")
|
| 437 |
chat_history.append({"role": "assistant", "content": answer})
|