Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -153,12 +153,26 @@ def main():
|
|
| 153 |
# Show history
|
| 154 |
for message in st.session_state.messages:
|
| 155 |
with st.chat_message(message["role"]):
|
| 156 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
if prompt := st.chat_input():
|
| 159 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 160 |
with st.chat_message("user"):
|
| 161 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
if st.session_state.messages[-1]["role"] != "assistant":
|
| 164 |
try:
|
|
@@ -166,7 +180,14 @@ def main():
|
|
| 166 |
response = user_input(prompt)
|
| 167 |
if response:
|
| 168 |
full_response = response['output_text']
|
| 169 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
| 171 |
except RuntimeError as e:
|
| 172 |
st.error(str(e))
|
|
|
|
| 153 |
# Show history
|
| 154 |
for message in st.session_state.messages:
|
| 155 |
with st.chat_message(message["role"]):
|
| 156 |
+
st.markdown(
|
| 157 |
+
f"""
|
| 158 |
+
<div style="direction: rtl; text-align: right; font-size: 16px;">
|
| 159 |
+
{message["content"]}
|
| 160 |
+
</div>
|
| 161 |
+
""",
|
| 162 |
+
unsafe_allow_html=True
|
| 163 |
+
)
|
| 164 |
|
| 165 |
if prompt := st.chat_input():
|
| 166 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
| 167 |
with st.chat_message("user"):
|
| 168 |
+
st.markdown(
|
| 169 |
+
f"""
|
| 170 |
+
<div style="direction: rtl; text-align: right; font-size: 16px;">
|
| 171 |
+
{prompt}
|
| 172 |
+
</div>
|
| 173 |
+
""",
|
| 174 |
+
unsafe_allow_html=True
|
| 175 |
+
)
|
| 176 |
|
| 177 |
if st.session_state.messages[-1]["role"] != "assistant":
|
| 178 |
try:
|
|
|
|
| 180 |
response = user_input(prompt)
|
| 181 |
if response:
|
| 182 |
full_response = response['output_text']
|
| 183 |
+
st.markdown(
|
| 184 |
+
f"""
|
| 185 |
+
<div style="direction: rtl; text-align: right; font-size: 16px;">
|
| 186 |
+
{full_response}
|
| 187 |
+
</div>
|
| 188 |
+
""",
|
| 189 |
+
unsafe_allow_html=True
|
| 190 |
+
)
|
| 191 |
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
| 192 |
except RuntimeError as e:
|
| 193 |
st.error(str(e))
|