Spaces:
Sleeping
Sleeping
Update app_web.py
Browse files- app_web.py +18 -1
app_web.py
CHANGED
|
@@ -232,11 +232,28 @@ def render_chat():
|
|
| 232 |
st.markdown(f"Please specify the value chain or investment area in {qinit_result.get('country', None)} for which you'd like to run a PERI analysis")
|
| 233 |
return
|
| 234 |
qcat_result = categorize_query(combined_cat, cfg, history)
|
| 235 |
-
print("result: ",
|
| 236 |
except Exception:
|
| 237 |
qinit_result = {"country": None, "value_chain": None, "investment": None}
|
| 238 |
qcat_result = {"category": "pillar_1", "action": "unresolved"}
|
| 239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
print("unresolved: ", unresolved)
|
| 241 |
print("result: ", qinit_result)
|
| 242 |
print("combined: ", combined_cat)
|
|
|
|
| 232 |
st.markdown(f"Please specify the value chain or investment area in {qinit_result.get('country', None)} for which you'd like to run a PERI analysis")
|
| 233 |
return
|
| 234 |
qcat_result = categorize_query(combined_cat, cfg, history)
|
| 235 |
+
print("result: ", qcat_result)
|
| 236 |
except Exception:
|
| 237 |
qinit_result = {"country": None, "value_chain": None, "investment": None}
|
| 238 |
qcat_result = {"category": "pillar_1", "action": "unresolved"}
|
| 239 |
|
| 240 |
+
pillar_dict = {
|
| 241 |
+
"pillar_1":f"would like to understand whether {qinit_result.get("value_chain")} aligns with the government's political incentives.",
|
| 242 |
+
"pillar_2":f"would like to understand to what degree decisions are impacted by the lobbying of particular groups or by elite influence",
|
| 243 |
+
"pillar_3":f"would like to understand if {qinit_result.get("value_chain")} and/or investing in {qinit_result.get("investment")} can be feasibly implemented given the broader institutional and policy environment",
|
| 244 |
+
|
| 245 |
+
}
|
| 246 |
+
|
| 247 |
+
st.session_state.unresolved_category = original_query_cat
|
| 248 |
+
st.session_state.unresolved_category_question = f"Please let me know if you {' and '.join([pillar_dict[c] for c in qcat_result.get("category")])}."
|
| 249 |
+
st.session_state.resolution_rounds += 1
|
| 250 |
+
resolution_msg = f"**Before I search, could you clarify?** Please let me know if you {' and '.join([pillar_dict[c] for c in qcat_result.get("category")])}."
|
| 251 |
+
st.session_state.messages.append({"role": "assistant", "content": resolution_msg})
|
| 252 |
+
|
| 253 |
+
with st.chat_message("assistant"):
|
| 254 |
+
st.markdown(resolution_msg)
|
| 255 |
+
return
|
| 256 |
+
|
| 257 |
print("unresolved: ", unresolved)
|
| 258 |
print("result: ", qinit_result)
|
| 259 |
print("combined: ", combined_cat)
|