Spaces:
Sleeping
Sleeping
Try to fix problems with method not being initialized in time
Browse files
app.py
CHANGED
|
@@ -34,22 +34,6 @@ st.markdown(
|
|
| 34 |
unsafe_allow_html=True
|
| 35 |
)
|
| 36 |
|
| 37 |
-
#st.title("Adrega AI Help")
|
| 38 |
-
col1, col2, col3 = st.columns([3, 1, 1])
|
| 39 |
-
|
| 40 |
-
with col1:
|
| 41 |
-
st.text_input('Ask me a question', key='user_input', on_change=handle_submit)
|
| 42 |
-
|
| 43 |
-
with col2:
|
| 44 |
-
st.session_state.include_context = st.checkbox('Search in Help')
|
| 45 |
-
|
| 46 |
-
if 'conversation' not in st.session_state:
|
| 47 |
-
st.session_state.conversation = ""
|
| 48 |
-
|
| 49 |
-
with col3:
|
| 50 |
-
if st.button("Ask"):
|
| 51 |
-
handle_submit()
|
| 52 |
-
|
| 53 |
def handle_submit():
|
| 54 |
user_input = st.session_state.user_input
|
| 55 |
if user_input:
|
|
@@ -76,5 +60,23 @@ def handle_submit():
|
|
| 76 |
st.session_state.conversation = f"<p><strong>User:</strong> {user_input}</p><p><strong>Adrega AI:</strong> {answer}</p>" + st.session_state.conversation
|
| 77 |
else:
|
| 78 |
st.write("Please enter a question.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
st.markdown(f'<div class="scrollable-div">{st.session_state.conversation}</div>', unsafe_allow_html=True)
|
|
|
|
| 34 |
unsafe_allow_html=True
|
| 35 |
)
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
def handle_submit():
|
| 38 |
user_input = st.session_state.user_input
|
| 39 |
if user_input:
|
|
|
|
| 60 |
st.session_state.conversation = f"<p><strong>User:</strong> {user_input}</p><p><strong>Adrega AI:</strong> {answer}</p>" + st.session_state.conversation
|
| 61 |
else:
|
| 62 |
st.write("Please enter a question.")
|
| 63 |
+
|
| 64 |
+
#st.title("Adrega AI Help")
|
| 65 |
+
col1, col2, col3 = st.columns([3, 1, 1])
|
| 66 |
+
|
| 67 |
+
with col1:
|
| 68 |
+
st.text_input('Ask me a question', key='user_input', on_change=handle_submit)
|
| 69 |
+
|
| 70 |
+
with col2:
|
| 71 |
+
st.session_state.include_context = st.checkbox('Search in Help')
|
| 72 |
+
|
| 73 |
+
if 'conversation' not in st.session_state:
|
| 74 |
+
st.session_state.conversation = ""
|
| 75 |
+
|
| 76 |
+
with col3:
|
| 77 |
+
if st.button("Ask"):
|
| 78 |
+
handle_submit()
|
| 79 |
+
|
| 80 |
+
|
| 81 |
|
| 82 |
st.markdown(f'<div class="scrollable-div">{st.session_state.conversation}</div>', unsafe_allow_html=True)
|