import re
import sentry_sdk
def extract_html_content(text: str):
# Use regex to find content within tags and include the tags themselves
match = re.search(r"(.*?)", text, re.DOTALL)
if match:
return match.group(1)
else:
# Otherwise, we just send the previous HTML over
print(
"[HTML Extraction] No tags found in the generated content: " + text
)
sentry_sdk.capture_exception(
Exception(" No tags found in the generated content")
)
return text