Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -121,26 +121,19 @@ def get_conversation_chain(vectorstore):
|
|
| 121 |
def handle_userinput(user_question):
|
| 122 |
"""
|
| 123 |
Handle user input and generate a response using the conversational retrieval chain.
|
| 124 |
-
|
| 125 |
Parameters
|
| 126 |
----------
|
| 127 |
user_question : str
|
| 128 |
The user's question.
|
| 129 |
-
|
| 130 |
"""
|
| 131 |
response = st.session_state.conversation({"question": user_question})
|
| 132 |
st.session_state.chat_history = response["chat_history"]
|
| 133 |
|
| 134 |
for i, message in enumerate(st.session_state.chat_history):
|
| 135 |
if i % 2 == 0:
|
| 136 |
-
st.write(
|
| 137 |
-
user_template.replace("{{MSG}}", message.content),
|
| 138 |
-
unsafe_allow_html=True,
|
| 139 |
-
)
|
| 140 |
else:
|
| 141 |
-
st.write(
|
| 142 |
-
bot_template.replace("{{MSG}}", message.content), unsafe_allow_html=True
|
| 143 |
-
)
|
| 144 |
|
| 145 |
|
| 146 |
def main():
|
|
|
|
| 121 |
def handle_userinput(user_question):
|
| 122 |
"""
|
| 123 |
Handle user input and generate a response using the conversational retrieval chain.
|
|
|
|
| 124 |
Parameters
|
| 125 |
----------
|
| 126 |
user_question : str
|
| 127 |
The user's question.
|
|
|
|
| 128 |
"""
|
| 129 |
response = st.session_state.conversation({"question": user_question})
|
| 130 |
st.session_state.chat_history = response["chat_history"]
|
| 131 |
|
| 132 |
for i, message in enumerate(st.session_state.chat_history):
|
| 133 |
if i % 2 == 0:
|
| 134 |
+
st.write("//_^ User: " + message.content)
|
|
|
|
|
|
|
|
|
|
| 135 |
else:
|
| 136 |
+
st.write("🤖 ChatBot: " + message.content)
|
|
|
|
|
|
|
| 137 |
|
| 138 |
|
| 139 |
def main():
|