Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +25 -12
src/streamlit_app.py
CHANGED
|
@@ -106,16 +106,29 @@ st.markdown("""
|
|
| 106 |
|
| 107 |
</style>
|
| 108 |
""", unsafe_allow_html=True)
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
st.session_state.messages = []
|
| 117 |
st.rerun()
|
| 118 |
|
|
|
|
|
|
|
| 119 |
# --- 5. INITIALIZE STATE ---
|
| 120 |
if "messages" not in st.session_state: st.session_state.messages = []
|
| 121 |
|
|
@@ -125,17 +138,17 @@ def load_system():
|
|
| 125 |
if backend_loaded: return get_rag_chain()
|
| 126 |
return None
|
| 127 |
|
| 128 |
-
# --- 7. HEADER ---
|
| 129 |
-
if mode
|
| 130 |
-
st.markdown("<
|
| 131 |
st.caption("Interactive AI Archive β’ Ask any question")
|
| 132 |
else:
|
| 133 |
-
st.markdown("<
|
| 134 |
st.caption("Direct Quote Search β’ Search the tapes")
|
| 135 |
|
| 136 |
if not backend_loaded: st.stop()
|
| 137 |
|
| 138 |
-
# --- 8. CHAT LOGIC
|
| 139 |
if mode.startswith("π£οΈ"):
|
| 140 |
# Initial Greeting
|
| 141 |
if not st.session_state.messages:
|
|
|
|
| 106 |
|
| 107 |
</style>
|
| 108 |
""", unsafe_allow_html=True)
|
| 109 |
+
# ... (Keep Sections 1, 2, and 3 exactly as they are) ...
|
| 110 |
+
|
| 111 |
+
# --- 4. NAVIGATION & SETTINGS (Moved to Main Page) ---
|
| 112 |
+
# We use columns to make it look neat on mobile
|
| 113 |
+
col1, col2 = st.columns([3, 1])
|
| 114 |
+
|
| 115 |
+
with col1:
|
| 116 |
+
# Mode Selection - Horizontal for better mobile layout
|
| 117 |
+
mode = st.radio(
|
| 118 |
+
"Select Mode:",
|
| 119 |
+
["π£οΈ Chat with Bro. Branham", "π Search Quotes Only"],
|
| 120 |
+
horizontal=True,
|
| 121 |
+
label_visibility="collapsed" # Hides the label to save space
|
| 122 |
+
)
|
| 123 |
+
|
| 124 |
+
with col2:
|
| 125 |
+
# A discreet 'Reset' button nicely aligned to the right
|
| 126 |
+
if st.button("π Reset", help="Start a new conversation", use_container_width=True):
|
| 127 |
st.session_state.messages = []
|
| 128 |
st.rerun()
|
| 129 |
|
| 130 |
+
st.divider()
|
| 131 |
+
|
| 132 |
# --- 5. INITIALIZE STATE ---
|
| 133 |
if "messages" not in st.session_state: st.session_state.messages = []
|
| 134 |
|
|
|
|
| 138 |
if backend_loaded: return get_rag_chain()
|
| 139 |
return None
|
| 140 |
|
| 141 |
+
# --- 7. HEADER (Dynamic based on Mode) ---
|
| 142 |
+
if mode == "π£οΈ Chat with Bro. Branham":
|
| 143 |
+
st.markdown("<h2 style='text-align: center;'>π¦
The 7th Handle</h2>", unsafe_allow_html=True)
|
| 144 |
st.caption("Interactive AI Archive β’ Ask any question")
|
| 145 |
else:
|
| 146 |
+
st.markdown("<h2 style='text-align: center;'>π The Table</h2>", unsafe_allow_html=True)
|
| 147 |
st.caption("Direct Quote Search β’ Search the tapes")
|
| 148 |
|
| 149 |
if not backend_loaded: st.stop()
|
| 150 |
|
| 151 |
+
# --- 8. CHAT LOGIC ---.
|
| 152 |
if mode.startswith("π£οΈ"):
|
| 153 |
# Initial Greeting
|
| 154 |
if not st.session_state.messages:
|