Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -117,14 +117,16 @@ def get_messages(client, thread):
|
|
117 |
|
118 |
#XXXXX
|
119 |
def extract_file_id(data):
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
|
|
128 |
|
129 |
def extract_content_values(data):
|
130 |
content_values = []
|
|
|
117 |
|
118 |
#XXXXX
|
119 |
def extract_file_id(data):
|
120 |
+
data = json.loads(data)
|
121 |
+
|
122 |
+
for step in data['data']:
|
123 |
+
if hasattr(step['step_details'], 'tool_calls'):
|
124 |
+
for tool_call in step['step_details'].tool_calls:
|
125 |
+
if hasattr(tool_call, 'code_interpreter') and hasattr(tool_call.code_interpreter, 'outputs'):
|
126 |
+
for output in tool_call.code_interpreter.outputs:
|
127 |
+
if hasattr(output, 'image') and hasattr(output.image, 'file_id'):
|
128 |
+
file_id = output.image.file_id
|
129 |
+
print(f"#############################################3Found file_id: {file_id}")
|
130 |
|
131 |
def extract_content_values(data):
|
132 |
content_values = []
|