Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -179,13 +179,19 @@ def list_messages(client, thread):
|
|
179 |
#show_json("messages", messages)
|
180 |
return messages
|
181 |
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
|
190 |
#
|
191 |
|
@@ -242,9 +248,10 @@ def chat(message, history, openai_api_key):
|
|
242 |
messages = list_messages(_client, _thread)
|
243 |
|
244 |
print("###")
|
245 |
-
|
|
|
246 |
print("###")
|
247 |
-
print(messages[0].content.text.value)
|
248 |
print("###")
|
249 |
|
250 |
# Call function
|
|
|
179 |
#show_json("messages", messages)
|
180 |
return messages
|
181 |
|
182 |
+
def extract_content_values(data):
|
183 |
+
content_values = []
|
184 |
+
for item in data.data:
|
185 |
+
print("###")
|
186 |
+
print(item)
|
187 |
+
print("###")
|
188 |
+
for content in item.content:
|
189 |
+
print("###")
|
190 |
+
print(content)
|
191 |
+
print("###")
|
192 |
+
if content.type == 'text':
|
193 |
+
content_values.append(content.text.value)
|
194 |
+
return content_values
|
195 |
|
196 |
#
|
197 |
|
|
|
248 |
messages = list_messages(_client, _thread)
|
249 |
|
250 |
print("###")
|
251 |
+
tmp = extract_content_values(messages)
|
252 |
+
#print(messages[0])
|
253 |
print("###")
|
254 |
+
#print(messages[0].content.text.value)
|
255 |
print("###")
|
256 |
|
257 |
# Call function
|