Anna Zhou commited on
Commit
e968f13
·
1 Parent(s): b1b5dab

Move usage guidance to navigation tab

Browse files
Files changed (1) hide show
  1. app/app.py +72 -19
app/app.py CHANGED
@@ -139,6 +139,7 @@ def _render_apa_source_links(raw_links, limit: int | None = None) -> None:
139
  def _render_navigation(current_page: str, conversation_id: str) -> None:
140
  nav_items = [
141
  ("ask", "Ask"),
 
142
  ("case_studies", "Case Studies"),
143
  ("previous_responses", "Previous Responses"),
144
  ("about", "About"),
@@ -168,7 +169,7 @@ def _render_navigation(current_page: str, conversation_id: str) -> None:
168
  """,
169
  unsafe_allow_html=True,
170
  )
171
- cols = st.columns([4.5, 0.9, 1.35, 1.75, 0.95])
172
  cols[0].markdown('<div class="rfr-nav-brand">RFR Knowledge Platform</div>', unsafe_allow_html=True)
173
  for col, (page, label) in zip(cols[1:], nav_items):
174
  if col.button(
@@ -319,7 +320,7 @@ def _metadata_answer_markdown(query: str) -> str | None:
319
 
320
  def _current_page() -> str:
321
  page = _get_query_param("page") or "ask"
322
- allowed = {"ask", "case_studies", "previous_responses", "about"}
323
  return page if page in allowed else "ask"
324
 
325
 
@@ -447,6 +448,70 @@ def _render_about_page() -> None:
447
  )
448
 
449
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  def _query_param_is_true(key: str) -> bool:
451
  if hasattr(st, "query_params"):
452
  value = st.query_params.get(key)
@@ -599,23 +664,7 @@ _render_navigation(current_page, conversation_id)
599
  with st.sidebar:
600
  st.markdown('<span id="about"></span>', unsafe_allow_html=True)
601
  st.header("About You & Your Community")
602
- st.markdown(
603
- """
604
- **How to use this tool:**
605
- Answer the questions below to help tailor responses to your context.
606
- All questions are optional — skip any that don't apply.
607
-
608
- Then type your question in the main panel. The tool will search
609
- across real managed retreat case studies and generate a response
610
- grounded in evidence from similar situations.
611
-
612
- > 💡 **Tip:** The more specific your question, the more useful
613
- > the answer. Try asking about funding models, community
614
- > engagement strategies, or what happened in a particular
615
- > type of community.
616
- """
617
- )
618
- st.divider()
619
 
620
  questions = load_questions()
621
  answers = {}
@@ -636,6 +685,10 @@ with st.sidebar:
636
 
637
  model_choice = "claude"
638
 
 
 
 
 
639
  if current_page == "case_studies":
640
  _render_case_studies_page()
641
  st.stop()
 
139
  def _render_navigation(current_page: str, conversation_id: str) -> None:
140
  nav_items = [
141
  ("ask", "Ask"),
142
+ ("how_to_use", "How to Use"),
143
  ("case_studies", "Case Studies"),
144
  ("previous_responses", "Previous Responses"),
145
  ("about", "About"),
 
169
  """,
170
  unsafe_allow_html=True,
171
  )
172
+ cols = st.columns([3.9, 0.85, 1.25, 1.35, 1.75, 0.9])
173
  cols[0].markdown('<div class="rfr-nav-brand">RFR Knowledge Platform</div>', unsafe_allow_html=True)
174
  for col, (page, label) in zip(cols[1:], nav_items):
175
  if col.button(
 
320
 
321
  def _current_page() -> str:
322
  page = _get_query_param("page") or "ask"
323
+ allowed = {"ask", "how_to_use", "case_studies", "previous_responses", "about"}
324
  return page if page in allowed else "ask"
325
 
326
 
 
448
  )
449
 
450
 
451
+ def _render_how_to_use_page() -> None:
452
+ st.title("How to Use This Tool")
453
+ st.caption("Guidelines for asking stronger questions and reading the answers responsibly.")
454
+
455
+ st.markdown(
456
+ """
457
+ ### 1. Add context in the sidebar
458
+
459
+ The sidebar questions are optional, but they help tailor the answer to your situation.
460
+ Use them to describe who you are, the type of hazard you are thinking about, where your
461
+ community is in the managed retreat process, and what concerns matter most.
462
+
463
+ ### 2. Ask one focused question at a time
464
+
465
+ Good questions usually name the topic you care about and the kind of answer you need.
466
+
467
+ **Examples:**
468
+ - What funding models have worked for floodplain buyout programs?
469
+ - How did communities maintain social cohesion after relocation?
470
+ - What barriers appeared in Indigenous or culturally distinct communities?
471
+ - Which cases involved strong public opposition, and how was it handled?
472
+ - What lessons from North American cases apply to municipal planners?
473
+
474
+ ### 3. Use case IDs when you want a specific case
475
+
476
+ If you ask about a case ID, the tool retrieves that case directly.
477
+
478
+ **Examples:**
479
+ - Summarize CS42.
480
+ - What were the equity issues in CS41?
481
+ - Compare CS8 and CS28.
482
+
483
+ ### 4. Use metadata questions for fast counts and lists
484
+
485
+ The tool answers geography and catalog questions directly from indexed metadata,
486
+ rather than asking the AI model to guess.
487
+
488
+ **Examples:**
489
+ - Give frequency tables by continent and country.
490
+ - Which case studies are in Europe?
491
+ - How many cases are outside North America?
492
+ - List all case studies in North Carolina.
493
+
494
+ ### 5. Check the case studies and source links
495
+
496
+ Open the **Case Studies** tab to review every indexed case. Each case includes a short
497
+ summary and clickable paper/source links in APA-style labels where available.
498
+
499
+ ### 6. Review previous answers
500
+
501
+ Open the **Previous Responses** tab to see the full answer history for your current
502
+ browser conversation. This is useful when comparing several questions or copying a
503
+ complete response with formatting.
504
+
505
+ ### 7. Treat answers as research support
506
+
507
+ The responses are generated from managed retreat case-study literature and may contain
508
+ omissions or interpretation errors. Verify important claims against the cited papers or
509
+ source links before using an answer in planning, policy, legal, engineering, or public
510
+ engagement work.
511
+ """
512
+ )
513
+
514
+
515
  def _query_param_is_true(key: str) -> bool:
516
  if hasattr(st, "query_params"):
517
  value = st.query_params.get(key)
 
664
  with st.sidebar:
665
  st.markdown('<span id="about"></span>', unsafe_allow_html=True)
666
  st.header("About You & Your Community")
667
+ st.caption("Optional context for tailoring answers. Skip any question that does not apply.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
668
 
669
  questions = load_questions()
670
  answers = {}
 
685
 
686
  model_choice = "claude"
687
 
688
+ if current_page == "how_to_use":
689
+ _render_how_to_use_page()
690
+ st.stop()
691
+
692
  if current_page == "case_studies":
693
  _render_case_studies_page()
694
  st.stop()