Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ def main():
|
|
20 |
if 'history' not in st.session_state:
|
21 |
st.session_state.history = []
|
22 |
|
23 |
-
user_input = st.text_input("
|
24 |
|
25 |
if st.session_state.get('enter_pressed', False):
|
26 |
if user_input: # Ensuring input is not empty
|
@@ -35,9 +35,9 @@ def display_conversation(user_input, response):
|
|
35 |
st.session_state.history.append(f"IT Support: {response}")
|
36 |
for i, message in enumerate(st.session_state.history[-10:]): # Display last 10 messages
|
37 |
if i % 2 == 0:
|
38 |
-
st.markdown(f"<div style='background-color:#e1f5fe;padding:10px;border-radius:10px;'>{message}
|
39 |
else:
|
40 |
-
st.markdown(f"<div style='background-color:#ffd7b5;padding:10px;border-radius:10px;'>{message}
|
41 |
st.session_state.enter_pressed = False # Reset the enter trigger
|
42 |
|
43 |
def get_message(user_input):
|
|
|
20 |
if 'history' not in st.session_state:
|
21 |
st.session_state.history = []
|
22 |
|
23 |
+
user_input = st.text_input("Tell us what's happening:", key="user_input", on_change=submit_on_enter)
|
24 |
|
25 |
if st.session_state.get('enter_pressed', False):
|
26 |
if user_input: # Ensuring input is not empty
|
|
|
35 |
st.session_state.history.append(f"IT Support: {response}")
|
36 |
for i, message in enumerate(st.session_state.history[-10:]): # Display last 10 messages
|
37 |
if i % 2 == 0:
|
38 |
+
st.markdown(f"<div style='background-color:#e1f5fe;padding:10px;border-radius:10px;'>{message}</div> ", unsafe_allow_html=True)
|
39 |
else:
|
40 |
+
st.markdown(f"<div style='background-color:#ffd7b5;padding:10px;border-radius:10px;'>{message}</div> ", unsafe_allow_html=True)
|
41 |
st.session_state.enter_pressed = False # Reset the enter trigger
|
42 |
|
43 |
def get_message(user_input):
|