Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -42,6 +42,10 @@ def chat_with_assistant(message, history):
|
|
42 |
# Retrieve the assistant's response
|
43 |
messages = client.beta.threads.messages.list(thread_id=thread.id)
|
44 |
content_block = messages.data[0].content[0]
|
|
|
|
|
|
|
|
|
45 |
if hasattr(content_block, 'text'):
|
46 |
assistant_response = content_block.text.value
|
47 |
elif hasattr(content_block, 'image'):
|
@@ -55,12 +59,6 @@ def chat_with_assistant(message, history):
|
|
55 |
|
56 |
return assistant_response
|
57 |
|
58 |
-
def bot(history):
|
59 |
-
user_message = history[-1][0]
|
60 |
-
bot_message = chat_with_assistant(user_message, history)
|
61 |
-
history[-1][1] = bot_message
|
62 |
-
return history
|
63 |
-
|
64 |
# Custom CSS for chat bubbles and colors
|
65 |
custom_css = """
|
66 |
.user-message { background-color: #DCF8C6; }
|
|
|
42 |
# Retrieve the assistant's response
|
43 |
messages = client.beta.threads.messages.list(thread_id=thread.id)
|
44 |
content_block = messages.data[0].content[0]
|
45 |
+
|
46 |
+
# Print the attributes of content_block for debugging
|
47 |
+
print("Content block attributes:", dir(content_block))
|
48 |
+
|
49 |
if hasattr(content_block, 'text'):
|
50 |
assistant_response = content_block.text.value
|
51 |
elif hasattr(content_block, 'image'):
|
|
|
59 |
|
60 |
return assistant_response
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
# Custom CSS for chat bubbles and colors
|
63 |
custom_css = """
|
64 |
.user-message { background-color: #DCF8C6; }
|