Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -117,7 +117,7 @@ prompt_placeholder = st.form("chat-form")
|
|
117 |
credit_card_placeholder = st.empty()
|
118 |
|
119 |
with chat_placeholder:
|
120 |
-
for chat in st.session_state.history:
|
121 |
div = f"""
|
122 |
|
123 |
<div class="chat-row
|
@@ -133,6 +133,25 @@ with chat_placeholder:
|
|
133 |
</div>
|
134 |
"""
|
135 |
st.markdown(div, unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
|
137 |
for _ in range(3):
|
138 |
st.markdown("")
|
|
|
117 |
credit_card_placeholder = st.empty()
|
118 |
|
119 |
with chat_placeholder:
|
120 |
+
for chat in st.session_state.history[:-1]:
|
121 |
div = f"""
|
122 |
|
123 |
<div class="chat-row
|
|
|
133 |
</div>
|
134 |
"""
|
135 |
st.markdown(div, unsafe_allow_html=True)
|
136 |
+
last_chat = st.session_state.history[-1]
|
137 |
+
div_start = f"""
|
138 |
+
<div class="chat-row
|
139 |
+
{'' if last_chat.origin == 'ai' else 'row-reverse'}">
|
140 |
+
<img class="chat-icon" src="https://cdn-icons-png.flaticon.com/{
|
141 |
+
'/512/3058/3058838.png' if last_chat.origin == 'ai'
|
142 |
+
else '512/1177/1177568.png'}"
|
143 |
+
width=32 height=32>
|
144 |
+
<div class="chat-bubble
|
145 |
+
{'ai-bubble' if last_chat.origin == 'ai' else 'human-bubble'}">
|
146 |
+
​"""
|
147 |
+
div_end = """
|
148 |
+
</div>
|
149 |
+
</div>
|
150 |
+
"""
|
151 |
+
new_placeholder = st.empty()
|
152 |
+
for j in range(len(last_chat.message)):
|
153 |
+
new_placeholder.markdown(div_start + last_chat.message[:j+1] + div_end, unsafe_allow_html=True)
|
154 |
+
time.sleep(0.05)
|
155 |
|
156 |
for _ in range(3):
|
157 |
st.markdown("")
|