Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -251,17 +251,18 @@ def file_management_sidebar():
|
|
251 |
st.session_state.selected_file = new_filename
|
252 |
st.session_state.view_mode = 'edit'
|
253 |
|
254 |
-
|
255 |
def main():
|
256 |
st.title("Markdown Content with AI Lookup and File Management")
|
257 |
|
258 |
# Process query parameters and AI lookup first
|
259 |
query_params = st.query_params
|
260 |
query = query_params.get('q', '')
|
261 |
-
|
262 |
|
|
|
263 |
if query:
|
264 |
-
|
265 |
st.write(f"### Search query received: {query}")
|
266 |
try:
|
267 |
ai_result = perform_ai_lookup(query)
|
@@ -278,24 +279,32 @@ def main():
|
|
278 |
# File management sidebar
|
279 |
file_management_sidebar()
|
280 |
|
281 |
-
# Display selected file content if any
|
282 |
if st.session_state.selected_file:
|
283 |
-
|
284 |
st.markdown(f"### Current File: {st.session_state.selected_file}")
|
285 |
display_file_content(st.session_state.selected_file)
|
286 |
|
287 |
-
#
|
288 |
-
if
|
289 |
-
|
290 |
-
st.markdown("### Terms with Links")
|
291 |
terms1 = extract_terms(Boxing_and_MMA_Commentary_and_Knowledge)
|
292 |
terms2 = extract_terms(Multiplayer_Custom_Hosting_Game_Servers_For_Simulated_Worlds)
|
293 |
all_terms = terms1 + terms2
|
294 |
-
|
|
|
295 |
|
296 |
-
|
297 |
-
|
298 |
-
with st.expander("Show Boxing and MMA Commentary"):
|
299 |
st.markdown(Boxing_and_MMA_Commentary_and_Knowledge)
|
300 |
-
|
301 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
st.session_state.selected_file = new_filename
|
252 |
st.session_state.view_mode = 'edit'
|
253 |
|
254 |
+
|
255 |
def main():
|
256 |
st.title("Markdown Content with AI Lookup and File Management")
|
257 |
|
258 |
# Process query parameters and AI lookup first
|
259 |
query_params = st.query_params
|
260 |
query = query_params.get('q', '')
|
261 |
+
show_initial_content = True # Flag to control initial content display
|
262 |
|
263 |
+
# First priority: Handle active query
|
264 |
if query:
|
265 |
+
show_initial_content = False # Hide initial content when showing query results
|
266 |
st.write(f"### Search query received: {query}")
|
267 |
try:
|
268 |
ai_result = perform_ai_lookup(query)
|
|
|
279 |
# File management sidebar
|
280 |
file_management_sidebar()
|
281 |
|
282 |
+
# Second priority: Display selected file content if any
|
283 |
if st.session_state.selected_file:
|
284 |
+
show_initial_content = False # Hide initial content when showing file content
|
285 |
st.markdown(f"### Current File: {st.session_state.selected_file}")
|
286 |
display_file_content(st.session_state.selected_file)
|
287 |
|
288 |
+
# Show initial content: Either when first landing or when no interactive elements are active
|
289 |
+
if show_initial_content:
|
290 |
+
# First show the clickable terms with links
|
|
|
291 |
terms1 = extract_terms(Boxing_and_MMA_Commentary_and_Knowledge)
|
292 |
terms2 = extract_terms(Multiplayer_Custom_Hosting_Game_Servers_For_Simulated_Worlds)
|
293 |
all_terms = terms1 + terms2
|
294 |
+
|
295 |
+
col1, col2 = st.columns(2)
|
296 |
|
297 |
+
with col1:
|
298 |
+
st.markdown("### Boxing & MMA")
|
|
|
299 |
st.markdown(Boxing_and_MMA_Commentary_and_Knowledge)
|
300 |
+
st.markdown("#### Related Links")
|
301 |
+
display_terms_with_links(terms1)
|
302 |
+
|
303 |
+
with col2:
|
304 |
+
st.markdown("### Multiplayer Games")
|
305 |
+
st.markdown(Multiplayer_Custom_Hosting_Game_Servers_For_Simulated_Worlds)
|
306 |
+
st.markdown("#### Related Links")
|
307 |
+
display_terms_with_links(terms2)
|
308 |
+
|
309 |
+
if __name__ == "__main__":
|
310 |
+
main()
|