Spaces:
Sleeping
Sleeping
redkye2
commited on
Commit
Β·
bebb5c6
1
Parent(s):
bb76a0d
test
Browse files
app.py
CHANGED
@@ -102,20 +102,24 @@ def get_conversation_chain(vectorstore):
|
|
102 |
)
|
103 |
return conversation_chain
|
104 |
|
|
|
105 |
# μ¬μ©μ μ
λ ₯μ μ²λ¦¬νλ ν¨μμ
λλ€.
|
106 |
def handle_userinput(user_question):
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
119 |
|
120 |
|
121 |
def main():
|
|
|
102 |
)
|
103 |
return conversation_chain
|
104 |
|
105 |
+
|
106 |
# μ¬μ©μ μ
λ ₯μ μ²λ¦¬νλ ν¨μμ
λλ€.
|
107 |
def handle_userinput(user_question):
|
108 |
+
if st.session_state.conversation is not None:
|
109 |
+
response = st.session_state.conversation({'question': user_question})
|
110 |
+
|
111 |
+
# Assuming response is a dictionary containing 'chat_history'
|
112 |
+
st.session_state.chat_history = response.get('chat_history', [])
|
113 |
+
|
114 |
+
for i, message in enumerate(st.session_state.chat_history):
|
115 |
+
if i % 2 == 0:
|
116 |
+
st.write(user_template.replace(
|
117 |
+
"{{MSG}}", message.content), unsafe_allow_html=True)
|
118 |
+
else:
|
119 |
+
st.write(bot_template.replace(
|
120 |
+
"{{MSG}}", message.content), unsafe_allow_html=True)
|
121 |
+
else:
|
122 |
+
st.warning("Conversation function is not defined.")
|
123 |
|
124 |
|
125 |
def main():
|