Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -101,6 +101,8 @@ def execute_langchain(user_input):
|
|
101 |
# Streamlit app layout
|
102 |
st.title("LangChain Chat")
|
103 |
|
|
|
|
|
104 |
while True:
|
105 |
user_input = st.text_input("You:", "")
|
106 |
|
@@ -108,17 +110,20 @@ while True:
|
|
108 |
if user_input:
|
109 |
# Execute LangChain logic
|
110 |
outputs = execute_langchain(user_input)
|
111 |
-
|
112 |
-
#
|
|
|
113 |
for key, value in outputs:
|
114 |
if key == "Output from node 'info':":
|
115 |
-
|
116 |
elif key == "Output from node 'profile':":
|
117 |
-
|
118 |
-
|
119 |
-
st.text("\n---\n")
|
120 |
|
|
|
|
|
|
|
121 |
# Allow the user to quit the chat
|
122 |
if st.button("Quit"):
|
123 |
st.text("Bot: Byebye")
|
|
|
124 |
|
|
|
101 |
# Streamlit app layout
|
102 |
st.title("LangChain Chat")
|
103 |
|
104 |
+
conversation_history = []
|
105 |
+
|
106 |
while True:
|
107 |
user_input = st.text_input("You:", "")
|
108 |
|
|
|
110 |
if user_input:
|
111 |
# Execute LangChain logic
|
112 |
outputs = execute_langchain(user_input)
|
113 |
+
|
114 |
+
# Update conversation history
|
115 |
+
conversation_history.append(("You", user_input))
|
116 |
for key, value in outputs:
|
117 |
if key == "Output from node 'info':":
|
118 |
+
conversation_history.append(("Bot", value))
|
119 |
elif key == "Output from node 'profile':":
|
120 |
+
conversation_history.append(("Bot", value))
|
|
|
|
|
121 |
|
122 |
+
# Display conversation history
|
123 |
+
st.text_area("Conversation:", value="\n".join([f"{sender}: {message}" for sender, message in conversation_history]))
|
124 |
+
|
125 |
# Allow the user to quit the chat
|
126 |
if st.button("Quit"):
|
127 |
st.text("Bot: Byebye")
|
128 |
+
break
|
129 |
|