Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -251,26 +251,17 @@ def file_management_sidebar():
|
|
251 |
st.session_state.selected_file = new_filename
|
252 |
st.session_state.view_mode = 'edit'
|
253 |
|
|
|
254 |
def main():
|
255 |
st.title("Markdown Content with AI Lookup and File Management")
|
256 |
|
257 |
-
#
|
258 |
-
st.markdown("## Original Markdown Content")
|
259 |
-
st.markdown(Boxing_and_MMA_Commentary_and_Knowledge)
|
260 |
-
st.markdown(Multiplayer_Custom_Hosting_Game_Servers_For_Simulated_Worlds)
|
261 |
-
|
262 |
-
# Parse and display terms with links
|
263 |
-
st.markdown("## Terms with Links")
|
264 |
-
terms1 = extract_terms(Boxing_and_MMA_Commentary_and_Knowledge)
|
265 |
-
terms2 = extract_terms(Multiplayer_Custom_Hosting_Game_Servers_For_Simulated_Worlds)
|
266 |
-
all_terms = terms1 + terms2
|
267 |
-
display_terms_with_links(all_terms)
|
268 |
-
|
269 |
-
# Process query parameters and AI lookup
|
270 |
query_params = st.query_params
|
271 |
query = query_params.get('q', '')
|
|
|
272 |
|
273 |
if query:
|
|
|
274 |
st.write(f"### Search query received: {query}")
|
275 |
try:
|
276 |
ai_result = perform_ai_lookup(query)
|
@@ -287,10 +278,24 @@ def main():
|
|
287 |
# File management sidebar
|
288 |
file_management_sidebar()
|
289 |
|
290 |
-
# Display selected file
|
291 |
if st.session_state.selected_file:
|
|
|
292 |
st.markdown(f"### Current File: {st.session_state.selected_file}")
|
293 |
display_file_content(st.session_state.selected_file)
|
294 |
|
295 |
-
if
|
296 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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_original_content = True # Flag to control original content display
|
262 |
|
263 |
if query:
|
264 |
+
show_original_content = False # Hide original content when showing query results
|
265 |
st.write(f"### Search query received: {query}")
|
266 |
try:
|
267 |
ai_result = perform_ai_lookup(query)
|
|
|
278 |
# File management sidebar
|
279 |
file_management_sidebar()
|
280 |
|
281 |
+
# Display selected file content if any
|
282 |
if st.session_state.selected_file:
|
283 |
+
show_original_content = False # Hide original content when showing file content
|
284 |
st.markdown(f"### Current File: {st.session_state.selected_file}")
|
285 |
display_file_content(st.session_state.selected_file)
|
286 |
|
287 |
+
# Only show original content if no file is selected and no query is being processed
|
288 |
+
if show_original_content:
|
289 |
+
st.markdown("## Available Content")
|
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 |
+
display_terms_with_links(all_terms)
|
295 |
+
|
296 |
+
# Show original markdown content last
|
297 |
+
st.markdown("### Original Markdown Content")
|
298 |
+
with st.expander("Show Boxing and MMA Commentary"):
|
299 |
+
st.markdown(Boxing_and_MMA_Commentary_and_Knowledge)
|
300 |
+
with st.expander("Show Multiplayer Games List"):
|
301 |
+
st.markdown(Multiplayer_Custom_Hosting_Game_Servers_For_Simulated_Worlds)
|