Update app.py
Browse files
app.py
CHANGED
@@ -54,11 +54,11 @@ booking process.
|
|
54 |
#Check if chat history exists in this session
|
55 |
if 'chat_history' not in st.session_state:
|
56 |
st.session_state.chat_history = [
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
{"role": "
|
62 |
] #Initialize chat history
|
63 |
|
64 |
# if 'model' not in st.session_state:
|
@@ -72,12 +72,12 @@ if input_text := st.chat_input(placeholder="Here you can chat with our hotel boo
|
|
72 |
|
73 |
with st.chat_message("user"):
|
74 |
st.markdown(input_text)
|
75 |
-
st.session_state.chat_history.append({"role" : "
|
76 |
|
77 |
with st.spinner("Generating response..."):
|
78 |
-
first_answer = demo_chat.demo_chain(input_text = input_text, history = st.session_state.
|
79 |
|
80 |
with st.chat_message("assistant"):
|
81 |
st.markdown(first_answer)
|
82 |
-
st.session_state.chat_history.append({"role": "
|
83 |
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
54 |
#Check if chat history exists in this session
|
55 |
if 'chat_history' not in st.session_state:
|
56 |
st.session_state.chat_history = [
|
57 |
+
{
|
58 |
+
"role": "system",
|
59 |
+
"content": system_content,
|
60 |
+
},
|
61 |
+
{"role": "ai", "content": "Hello, how can I help you today?"},
|
62 |
] #Initialize chat history
|
63 |
|
64 |
# if 'model' not in st.session_state:
|
|
|
72 |
|
73 |
with st.chat_message("user"):
|
74 |
st.markdown(input_text)
|
75 |
+
st.session_state.chat_history.append({"role" : "human", "content" : input_text}) #append message to chat history
|
76 |
|
77 |
with st.spinner("Generating response..."):
|
78 |
+
first_answer = demo_chat.demo_chain(input_text = input_text, history = st.session_state.memory)
|
79 |
|
80 |
with st.chat_message("assistant"):
|
81 |
st.markdown(first_answer)
|
82 |
+
st.session_state.chat_history.append({"role": "ai", "content": first_answer})
|
83 |
st.markdown('</div>', unsafe_allow_html=True)
|