Spaces:
Sleeping
Sleeping
Update src/app.py
Browse files- src/app.py +12 -12
src/app.py
CHANGED
|
@@ -142,18 +142,18 @@ if len(chat_model.conversation.messages) != len(st.session_state.messages):
|
|
| 142 |
|
| 143 |
chat_container = st.container()
|
| 144 |
|
| 145 |
-
with chat_container:
|
| 146 |
-
for message in st.session_state.messages:
|
| 147 |
-
role = message["role"]
|
| 148 |
-
content = message["content"]
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
with st.chat_message(role):
|
| 154 |
-
st.markdown(content)
|
| 155 |
|
| 156 |
-
|
| 157 |
# limpa o historico
|
| 158 |
st.session_state.messages = []
|
| 159 |
st.session_state.chat_model.clear_history()
|
|
@@ -165,9 +165,9 @@ with chat_container:
|
|
| 165 |
st.session_state.messages.append({"role": "user", "content": user_input})
|
| 166 |
|
| 167 |
with st.chat_message("user"):
|
| 168 |
-
st.markdown(user_input)
|
| 169 |
|
| 170 |
-
with st.chat_message("assistant"):
|
| 171 |
response_placeholder = st.empty()
|
| 172 |
full_response = ""
|
| 173 |
|
|
|
|
| 142 |
|
| 143 |
chat_container = st.container()
|
| 144 |
|
| 145 |
+
#with chat_container:
|
| 146 |
+
# for message in st.session_state.messages:
|
| 147 |
+
# role = message["role"]
|
| 148 |
+
# content = message["content"]
|
| 149 |
+
#
|
| 150 |
+
# if role == "system":
|
| 151 |
+
# continue
|
| 152 |
|
| 153 |
+
# with st.chat_message(role):
|
| 154 |
+
# st.markdown(content)
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
+
if user_input := st.chat_input("Digite sua mensagem..."):
|
| 157 |
# limpa o historico
|
| 158 |
st.session_state.messages = []
|
| 159 |
st.session_state.chat_model.clear_history()
|
|
|
|
| 165 |
st.session_state.messages.append({"role": "user", "content": user_input})
|
| 166 |
|
| 167 |
with st.chat_message("user"):
|
| 168 |
+
chat_container.st.markdown(user_input)
|
| 169 |
|
| 170 |
+
with chat_container.st.chat_message("assistant"):
|
| 171 |
response_placeholder = st.empty()
|
| 172 |
full_response = ""
|
| 173 |
|