Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,13 +58,23 @@ elif hasattr(st.session_state.run, 'status') and st.session_state.run.status ==
|
|
| 58 |
thread_id=st.session_state.thread.id
|
| 59 |
)
|
| 60 |
|
|
|
|
| 61 |
# Display messages
|
| 62 |
for message in reversed(st.session_state.messages.data):
|
| 63 |
if message.role in ["user", "assistant"]:
|
| 64 |
with st.chat_message(message.role):
|
| 65 |
for content_part in message.content:
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
if prompt := st.chat_input("Wie kann ich dir helfen?"):
|
| 70 |
with st.chat_message('user'):
|
|
|
|
| 58 |
thread_id=st.session_state.thread.id
|
| 59 |
)
|
| 60 |
|
| 61 |
+
|
| 62 |
# Display messages
|
| 63 |
for message in reversed(st.session_state.messages.data):
|
| 64 |
if message.role in ["user", "assistant"]:
|
| 65 |
with st.chat_message(message.role):
|
| 66 |
for content_part in message.content:
|
| 67 |
+
# Check if the content part is a text message
|
| 68 |
+
if hasattr(content_part, 'text'):
|
| 69 |
+
message_text = content_part.text.value
|
| 70 |
+
st.markdown(message_text)
|
| 71 |
+
# Check if the content part is an image file
|
| 72 |
+
elif hasattr(content_part, 'image'):
|
| 73 |
+
# Handle the image file. For example, display it in Streamlit.
|
| 74 |
+
# You'll need to write the appropriate code to handle the image based on your requirements.
|
| 75 |
+
image_url = content_part.image.url # Example: Get the image URL
|
| 76 |
+
st.image(image_url, caption="Generated Image")
|
| 77 |
+
|
| 78 |
|
| 79 |
if prompt := st.chat_input("Wie kann ich dir helfen?"):
|
| 80 |
with st.chat_message('user'):
|