Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions adi_function_app/adi_2_ai_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def update_figure_description(
"""

# Define the new string to replace the old content
new_string = f'<!-- FigureId="{figure_id}" FigureContent="{img_description}" -->'
new_string = f"""<!-- FigureId="{figure_id}
" FigureContent="{img_description}" -->"""

# Calculate the end index of the content to be replaced
end_index = offset + length
Expand Down Expand Up @@ -537,9 +538,6 @@ async def process_adi_2_ai_search(record: dict, chunk_by_page: bool = False) ->
result, operation_id = await analyse_document(temp_file_path)
except ValueError as inner_e:
logging.error(inner_e)
logging.error(
f"Failed to analyze the document with Azure Document Intelligence: {e}"
)
logging.error(
"Failed to analyse %s with Azure Document Intelligence.", blob
)
Expand Down Expand Up @@ -607,7 +605,14 @@ async def process_adi_2_ai_search(record: dict, chunk_by_page: bool = False) ->
)
}
for future in concurrent.futures.as_completed(futures):
cleaned_result.append(future.result())
result = future.result()
if len(result["content"]) == 0:
logging.error(
"No content found in the cleaned result for slide %s.",
result["pageNumber"],
)
else:
cleaned_result.append(result)

else:
markdown_content = result.content
Expand Down