Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -108,24 +108,24 @@ message.write("Good to see you. Please tell me your latest career")
|
|
108 |
|
109 |
|
110 |
user_input = st.chat_input("Enter your Response")
|
|
|
|
|
|
|
111 |
|
112 |
if st.button("Send"):
|
113 |
if user_input:
|
114 |
# Execute LangChain logic
|
115 |
-
outputs = execute_langchain(user_input)
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
conversation_history.append(("Bot", value))
|
125 |
-
message.write(value)
|
126 |
-
|
127 |
# Allow the user to quit the chat
|
128 |
if st.button("Quit"):
|
129 |
st.text("Bot: Byebye")
|
130 |
-
|
131 |
|
|
|
108 |
|
109 |
|
110 |
user_input = st.chat_input("Enter your Response")
|
111 |
+
|
112 |
+
if "chat_history" not in st.session_state:
|
113 |
+
st.session_state["chat_history"] = []
|
114 |
|
115 |
if st.button("Send"):
|
116 |
if user_input:
|
117 |
# Execute LangChain logic
|
118 |
+
outputs = execute_langchain(user_input)
|
119 |
+
# Update chat history
|
120 |
+
st.session_state["chat_history"].append({"message": user_input, "role": "user"})
|
121 |
+
st.session_state["chat_history"].append({"message": outputs, "role": "bot"})
|
122 |
+
|
123 |
+
# Display chat history
|
124 |
+
for message in st.session_state["chat_history"]:
|
125 |
+
st.chat_message(message["message"], key=message["message"])
|
126 |
+
|
|
|
|
|
|
|
127 |
# Allow the user to quit the chat
|
128 |
if st.button("Quit"):
|
129 |
st.text("Bot: Byebye")
|
130 |
+
|
131 |
|