Spaces:
Running
Running
Commit
·
0aa9e50
1
Parent(s):
b4cb4dd
Update app.py
Browse files
app.py
CHANGED
@@ -44,13 +44,14 @@ if prompt := st.chat_input("Ask me anything.."):
|
|
44 |
st.chat_message("User").markdown(prompt)
|
45 |
# Add user message to chat history
|
46 |
st.session_state.messages.append({"role": "User", "content": prompt})
|
47 |
-
|
48 |
-
response = st.session_state.chain.invoke(
|
49 |
-
config={"configurable": {"session_id": "foobar"}},)
|
50 |
|
51 |
# Display assistant response in chat message container
|
52 |
with st.chat_message("Jojo"):
|
53 |
st.markdown(response)
|
|
|
|
|
54 |
# Add assistant response to chat history
|
55 |
st.session_state.messages.append({"role": "Jojo", "content": response})
|
56 |
|
|
|
44 |
st.chat_message("User").markdown(prompt)
|
45 |
# Add user message to chat history
|
46 |
st.session_state.messages.append({"role": "User", "content": prompt})
|
47 |
+
|
48 |
+
response = st.session_state.chain.invoke(prompt)
|
|
|
49 |
|
50 |
# Display assistant response in chat message container
|
51 |
with st.chat_message("Jojo"):
|
52 |
st.markdown(response)
|
53 |
+
memory.save_context({"question":prompt}, {"output":prompt})
|
54 |
+
memory.chat_memory.messages = memory.chat_memory.messages[-15:]
|
55 |
# Add assistant response to chat history
|
56 |
st.session_state.messages.append({"role": "Jojo", "content": response})
|
57 |
|