Skip to content
Open
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
12 changes: 8 additions & 4 deletions deploy/docker/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ async def handle_llm_qa(
crawler = await get_crawler(browser_cfg)
result = await crawler.arun(url)
if not result.success:
err = result.error_message or "Crawl failed"
code = status.HTTP_403_FORBIDDEN if "blocked" in err.lower() or "anti-bot" in err.lower() else status.HTTP_500_INTERNAL_SERVER_ERROR
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail=result.error_message
status_code=code,
detail=err
)
content = result.markdown.fit_markdown or result.markdown.raw_markdown

Expand Down Expand Up @@ -390,9 +392,11 @@ async def handle_markdown_request(
)

if not result.success:
err = result.error_message or "Crawl failed"
code = status.HTTP_403_FORBIDDEN if "blocked" in err.lower() or "anti-bot" in err.lower() else status.HTTP_500_INTERNAL_SERVER_ERROR
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail=result.error_message
status_code=code,
detail=err
)

return (result.markdown.raw_markdown
Expand Down