Nelly-43 commited on
Commit
337e106
·
verified ·
1 Parent(s): abe02ea

Update app_web.py

Browse files
Files changed (1) hide show
  1. app_web.py +18 -16
app_web.py CHANGED
@@ -244,29 +244,31 @@ def render_chat():
244
  "pillar_3":f"would like to understand if {','.join(qinit_result.get('value_chain'))} and/or investing in {','.join(qinit_result.get('investment'))} can be feasibly implemented given the broader institutional and policy environment",
245
 
246
  }
247
-
248
- if qinit_result.get("country", None)[0]==None:
249
- resolution_msg = """It seems there is no country specified for the analysis. Currently the PERI framework supports analysis for the countries listed below:\n\n -{'\n -'.join(APPROVED_OPTIONS.get('countries'))}\n\n We are also continuously \
250
- working to expand the framework and you can submit a form if the country you would like to run the analysis on is not included. In the meantime please let me know if you would like to run the anlysis for one of the included countries."""
251
 
252
- if qinit_result.get("value_chain", None)[0]==None and qinit_result.get("investment", None)[0]==None:
 
 
 
 
 
 
253
  resolution_msg = f"It seems there is no value chain or investment area specified for the analysis. Please select one of the value chains or investment areas included in the current PERI framework."
254
 
255
- if qinit_result.get("country", None)[0] not in APPROVED_OPTIONS.get('countries'):
256
- resolution_msg = """It seems you are trying to run a PERI analysis for {qinit_result.get("country", None)[0]}! Currently the PERI framework only supports analysis for the countries listed below:\n\n -{'\n -'.join(APPROVED_OPTIONS.get('countries'))}\n\n We are continuously \
257
- working to expand the framework and you can submit a form to request. In the meantime please let me know if you would like to run the anlysis for one of the included countries."""
258
 
259
- if qinit_result.get("value_chain", None)[0] not in APPROVED_OPTIONS.get('value_chains'):
260
- resolution_msg = """It seems you are trying to run a PERI analysis for {qinit_result.get("value_chain", None)[0]} in {qinit_result.get("country", None)[0]}! Currently the PERI framework only supports analysis for the value chains listed below:\n\n -{'\n -'.join(APPROVED_OPTIONS.get('value_chains'))}\n\n We are continuously \
261
- working to expand the framework and you can submit a form to request. In the meantime please let me know if you would like to run the anlysis for one of the included countries."""
262
 
263
- if qinit_result.get("investment", None)[0] not in APPROVED_OPTIONS.get('investments'):
264
- resolution_msg = """It seems you are trying to run a PERI analysis for {qinit_result.get("investment", None)[0]} investemnt in {qinit_result.get("country", None)[0]}! Currently the PERI framework only supports analysis for the investment areas listed below:\n\n -{'\n -'.join(APPROVED_OPTIONS.get('investments'))}\n\n We are continuously \
265
- working to expand the framework and you can submit a form to request. In the meantime please let me know if you would like to run the anlysis for one of the included countries."""
266
 
267
- if qinit_result.get("country", None)[0] in APPROVED_OPTIONS.get('countries') and (qinit_result.get("value_chain", None)[0] in APPROVED_OPTIONS.get('value_chains') or qinit_result.get("investment", None)[0] in APPROVED_OPTIONS.get('investments')):
268
  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')])}."
269
-
270
  # 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')])}."
271
  st.session_state.unresolved_category_question = resolution_msg
272
  st.session_state.unresolved_category = original_query_cat
 
244
  "pillar_3":f"would like to understand if {','.join(qinit_result.get('value_chain'))} and/or investing in {','.join(qinit_result.get('investment'))} can be feasibly implemented given the broader institutional and policy environment",
245
 
246
  }
 
 
 
 
247
 
248
+ esc_char = "\n"
249
+ esc_char1 = "\n -"
250
+ if qinit_result.get("country", None)==None:
251
+ resolution_msg = f"It seems there is no country specified for the analysis. Currently the PERI framework supports analysis for the countries listed below:\n\n -{'esc_char1'.join(APPROVED_OPTIONS.get('countries'))}\n\n We are also continuously \
252
+ working to expand the framework and you can submit a form if the country you would like to run the analysis on is not included. In the meantime please let me know if you would like to run the anlysis for one of the included countries."
253
+
254
+ if qinit_result.get("value_chain", None)==None and qinit_result.get("investment", None)==None:
255
  resolution_msg = f"It seems there is no value chain or investment area specified for the analysis. Please select one of the value chains or investment areas included in the current PERI framework."
256
 
257
+ if qinit_result.get("country", None) not in APPROVED_OPTIONS.get('countries'):
258
+ resolution_msg = f"It seems you are trying to run a PERI analysis for {qinit_result.get("country", None)}! Currently the PERI framework only supports analysis for the countries listed below:\n\n -{'esc_char1'.join(APPROVED_OPTIONS.get('countries'))}\n\n We are continuously \
259
+ working to expand the framework and you can submit a form to request. In the meantime please let me know if you would like to run the anlysis for one of the included countries."
260
 
261
+ if qinit_result.get("value_chain", None) not in APPROVED_OPTIONS.get('value_chains'):
262
+ resolution_msg = f"It seems you are trying to run a PERI analysis for {qinit_result.get("value_chain", None)} in {qinit_result.get("country", None)}! Currently the PERI framework only supports analysis for the value chains listed below:\n\n -{'esc_char1'.join(APPROVED_OPTIONS.get('value_chains'))}\n\n We are continuously \
263
+ working to expand the framework and you can submit a form to request. In the meantime please let me know if you would like to run the anlysis for one of the included countries."
264
 
265
+ if qinit_result.get("investment", None) not in APPROVED_OPTIONS.get('investments'):
266
+ resolution_msg = f"It seems you are trying to run a PERI analysis for {qinit_result.get("investment", None)} investemnt in {qinit_result.get("country", None)}! Currently the PERI framework only supports analysis for the investment areas listed below:\n\n -{'esc_char1'.join(APPROVED_OPTIONS.get('investments'))}\n\n We are continuously \
267
+ working to expand the framework and you can submit a form to request. In the meantime please let me know if you would like to run the anlysis for one of the included countries."
268
 
269
+ if qinit_result.get("country", None) in APPROVED_OPTIONS.get('countries') and (qinit_result.get("value_chain", None) in APPROVED_OPTIONS.get('value_chains') or qinit_result.get("investment", None) in APPROVED_OPTIONS.get('investments')):
270
  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')])}."
271
+
272
  # 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')])}."
273
  st.session_state.unresolved_category_question = resolution_msg
274
  st.session_state.unresolved_category = original_query_cat