Spaces:
Runtime error
Runtime error
Bugfix to handle no data in group_topic_children
Browse files
ingest.py
CHANGED
@@ -153,11 +153,11 @@ def ingest_canvas_discussions(input_url, access_token):
|
|
153 |
print(f'Error: {instruction_response.text}')
|
154 |
|
155 |
# Check if the discussion is an individual discussion with associated group-based discussions
|
156 |
-
if 'group_topic_children' in instruction_data:
|
157 |
# Extract and save group-based discussions
|
158 |
group_entries = extract_group_discussions(instruction_data['group_topic_children'], headers)
|
159 |
os.makedirs('docs', exist_ok=True)
|
160 |
-
print("Extracted group discussion entries")
|
161 |
for group_entry in group_entries:
|
162 |
save_messages(group_entry['entries'], group_entry['group_id'])
|
163 |
else:
|
|
|
153 |
print(f'Error: {instruction_response.text}')
|
154 |
|
155 |
# Check if the discussion is an individual discussion with associated group-based discussions
|
156 |
+
if 'group_topic_children' in instruction_data and len(instruction_data['group_topic_children']) > 0:
|
157 |
# Extract and save group-based discussions
|
158 |
group_entries = extract_group_discussions(instruction_data['group_topic_children'], headers)
|
159 |
os.makedirs('docs', exist_ok=True)
|
160 |
+
print("Extracted group discussion entries: {}", str(len(group_entries)))
|
161 |
for group_entry in group_entries:
|
162 |
save_messages(group_entry['entries'], group_entry['group_id'])
|
163 |
else:
|