Spaces:
Sleeping
Sleeping
Resolved the issue where the new prompt window was not showing up.
Browse files
app.py
CHANGED
|
@@ -102,14 +102,20 @@ if st.session_state.authenticated:
|
|
| 102 |
# New prompt window with sample questions
|
| 103 |
if st.session_state.query_history: # Show only after at least one query
|
| 104 |
st.markdown("### Ask Another Question")
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
| 106 |
if st.button("Submit New Query"):
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
# Sidebar with logo, text, and instructions (always shown)
|
| 115 |
st.sidebar.image("UMC_Logo.png", width=200) # Adjusted logo size for sidebar
|
|
@@ -118,4 +124,4 @@ st.sidebar.markdown('<div class="spacer"></div>', unsafe_allow_html=True) # Add
|
|
| 118 |
st.sidebar.header("Instructions")
|
| 119 |
st.sidebar.write("Enter a question about The United Methodist Church's Book Of Discipline 2020-2024. The assistant will retrieve relevant sections and explain them in simple language, citing parts, paragraphs, and titles as needed.")
|
| 120 |
st.sidebar.header("About")
|
| 121 |
-
st.sidebar.write("Powered by
|
|
|
|
| 102 |
# New prompt window with sample questions
|
| 103 |
if st.session_state.query_history: # Show only after at least one query
|
| 104 |
st.markdown("### Ask Another Question")
|
| 105 |
+
selected_query = st.selectbox("Pick another question or type your own:", [""] + sample_questions, key="new_query_select")
|
| 106 |
+
custom_query = st.text_input("Your new question:", key="new_query_input")
|
| 107 |
+
# Use custom query if provided, otherwise use selected query
|
| 108 |
+
new_query = custom_query if custom_query else selected_query
|
| 109 |
if st.button("Submit New Query"):
|
| 110 |
+
if new_query: # Ensure a query is provided
|
| 111 |
+
with st.spinner("Fetching response..."):
|
| 112 |
+
results = vector_store.similarity_search(new_query, k=5)
|
| 113 |
+
st.session_state.retrieved_chunks = results
|
| 114 |
+
response = query_rag(new_query)
|
| 115 |
+
st.session_state.query_history.append((new_query, response))
|
| 116 |
+
st.experimental_rerun() # Refresh to show new response
|
| 117 |
+
else:
|
| 118 |
+
st.warning("Please select a question or enter a new one.")
|
| 119 |
|
| 120 |
# Sidebar with logo, text, and instructions (always shown)
|
| 121 |
st.sidebar.image("UMC_Logo.png", width=200) # Adjusted logo size for sidebar
|
|
|
|
| 124 |
st.sidebar.header("Instructions")
|
| 125 |
st.sidebar.write("Enter a question about The United Methodist Church's Book Of Discipline 2020-2024. The assistant will retrieve relevant sections and explain them in simple language, citing parts, paragraphs, and titles as needed.")
|
| 126 |
st.sidebar.header("About")
|
| 127 |
+
st.sidebar.write("Powered by ekSource Technologies, Inc")
|