h-ai-brain 0.0.3__py3-none-any.whl → 0.0.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- h_ai/application/web_docs_service.py +1 -0
- h_ai/domain/web_docs/web_docs_link_detector.py +2 -0
- h_ai/infrastructure/playwright/playwright_web_content_fetcher.py +14 -4
- {h_ai_brain-0.0.3.dist-info → h_ai_brain-0.0.5.dist-info}/METADATA +1 -1
- {h_ai_brain-0.0.3.dist-info → h_ai_brain-0.0.5.dist-info}/RECORD +9 -9
- {h_ai_brain-0.0.3.dist-info → h_ai_brain-0.0.5.dist-info}/WHEEL +0 -0
- {h_ai_brain-0.0.3.dist-info → h_ai_brain-0.0.5.dist-info}/licenses/LICENSE +0 -0
- {h_ai_brain-0.0.3.dist-info → h_ai_brain-0.0.5.dist-info}/licenses/NOTICE.txt +0 -0
- {h_ai_brain-0.0.3.dist-info → h_ai_brain-0.0.5.dist-info}/top_level.txt +0 -0
@@ -23,6 +23,7 @@ class WebDocsService:
|
|
23
23
|
async def discover_documentation(self, website_url: str) -> Optional[List[TextPage]]:
|
24
24
|
detected_links = await self.detect_documentation_links(website_url)
|
25
25
|
for link in detected_links:
|
26
|
+
print(f"Fetching {link.url}")
|
26
27
|
gitbook_fetcher = GitbookWebFetcherService(link.url)
|
27
28
|
gitbook_pages = await gitbook_fetcher.fetch()
|
28
29
|
return gitbook_pages
|
@@ -14,12 +14,15 @@ class PlayWrightWebContentFetcher(WebFetcherRepository):
|
|
14
14
|
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
15
15
|
'Accept-Language': 'en-US,en;q=0.5'
|
16
16
|
}
|
17
|
-
self.page_load_timeout =
|
17
|
+
self.page_load_timeout = 60
|
18
18
|
self.wait_for_idle = True
|
19
19
|
|
20
20
|
async def fetch(self, url: str) -> Optional[str]:
|
21
21
|
async with async_playwright() as p:
|
22
|
-
browser = await p.chromium.launch()
|
22
|
+
browser = await p.chromium.launch(headless=True)
|
23
|
+
logger.debug(
|
24
|
+
f"Launching headless browser with user agent: {self.headers.get('User-Agent')}"
|
25
|
+
)
|
23
26
|
try:
|
24
27
|
context = await browser.new_context(
|
25
28
|
user_agent=self.headers.get('User-Agent')
|
@@ -29,12 +32,19 @@ class PlayWrightWebContentFetcher(WebFetcherRepository):
|
|
29
32
|
# Set timeout
|
30
33
|
page.set_default_timeout(self.page_load_timeout * 1000) # Convert to ms
|
31
34
|
|
35
|
+
page.on("console", lambda msg: logger.debug(f"Browser console {url}: {msg.text}"))
|
36
|
+
|
32
37
|
# Navigate to the URL
|
33
|
-
await page.goto(url)
|
38
|
+
await page.goto(url, timeout=self.page_load_timeout * 1000, wait_until='domcontentloaded')
|
34
39
|
|
35
40
|
# Wait for network to be idle if requested
|
36
41
|
if self.wait_for_idle:
|
37
|
-
|
42
|
+
logger.debug(f"Waiting for network idle on {url}")
|
43
|
+
|
44
|
+
await page.wait_for_load_state("networkidle", timeout=self.page_load_timeout * 1000)
|
45
|
+
logger.debug(
|
46
|
+
f"Network idle on {url} after {self.page_load_timeout} seconds"
|
47
|
+
)
|
38
48
|
|
39
49
|
logger.debug(f"Successfully fetched {url} with headless browser")
|
40
50
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
h_ai/__init__.py,sha256=bmHMDoui52Q73UvXdHslQ3w_LubmhRuKRlrjOYyCP8c,153
|
2
2
|
h_ai/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
h_ai/application/hai_service.py,sha256=DpSx1_QYS_3N5OwY5U4My0WwH-e4tvRHNeJxSduGoZM,2200
|
4
|
-
h_ai/application/web_docs_service.py,sha256=
|
4
|
+
h_ai/application/web_docs_service.py,sha256=YiPBfPyjlloDq6CIOP0u7F1jNBK-elYRU8xl4qJ1oVc,1652
|
5
5
|
h_ai/application/system_prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
h_ai/application/system_prompts/roles/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
7
|
h_ai/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -15,7 +15,7 @@ h_ai/domain/web_docs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
15
15
|
h_ai/domain/web_docs/doc_link_scorer_service.py,sha256=EmLSOaX7BCUQcKHZquaUt-Ps_DssZrRqpch5MgbUhAc,1444
|
16
16
|
h_ai/domain/web_docs/documentation_pattern_repository.py,sha256=VhNzP3PUqgg9MaWhBVefj13XNxRBh6ZPUt-KH70ww2w,1302
|
17
17
|
h_ai/domain/web_docs/gitbook_web_fetcher_service.py,sha256=Ye-TcuwgW1fhIY8x6v9_-pmPN9pVFWzlOpwRt-4teaA,6490
|
18
|
-
h_ai/domain/web_docs/web_docs_link_detector.py,sha256=
|
18
|
+
h_ai/domain/web_docs/web_docs_link_detector.py,sha256=NyMKFNs-41bqrxx6u-9GqIufy7pkDF_-_f1h8HECBK8,1192
|
19
19
|
h_ai/domain/web_docs/web_link.py,sha256=J4KC3MmjkvWlAPDdEdjcqAZCvuSnJMahudCohiBk3wk,307
|
20
20
|
h_ai/domain/web_docs/gitbook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
21
|
h_ai/domain/web_docs/gitbook/text_chapter.py,sha256=XiZZlt128uA6oq-4bQfOpFf-djoHiQEsWpFDzRCNXdk,534
|
@@ -39,10 +39,10 @@ h_ai/infrastructure/llm/ollama/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
|
|
39
39
|
h_ai/infrastructure/llm/ollama/models/ollama_chat_message.py,sha256=ZIz4PQ3869vI3xAYYufPrxXpacajRDtOI8RDl5Dm9RQ,305
|
40
40
|
h_ai/infrastructure/llm/ollama/models/ollama_chat_session.py,sha256=GZ_ddpbWa8iy6NZq50vokUFVZBiX0WNa81z9-r9RzTY,392
|
41
41
|
h_ai/infrastructure/playwright/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
42
|
-
h_ai/infrastructure/playwright/playwright_web_content_fetcher.py,sha256=
|
43
|
-
h_ai_brain-0.0.
|
44
|
-
h_ai_brain-0.0.
|
45
|
-
h_ai_brain-0.0.
|
46
|
-
h_ai_brain-0.0.
|
47
|
-
h_ai_brain-0.0.
|
48
|
-
h_ai_brain-0.0.
|
42
|
+
h_ai/infrastructure/playwright/playwright_web_content_fetcher.py,sha256=fcf8ZxIR2bLU1rV378ASQUaI26PvaX7sYqQb1SDlkt4,2401
|
43
|
+
h_ai_brain-0.0.5.dist-info/licenses/LICENSE,sha256=SbvpEU5JIU3yzMMkyzrI0dGqHDoJR_lMKGdl6GZHsy4,11558
|
44
|
+
h_ai_brain-0.0.5.dist-info/licenses/NOTICE.txt,sha256=vxeIKUiGqAePLvDW4AVm3Xh-3BcsvMtCMn1tbsr9zsE,668
|
45
|
+
h_ai_brain-0.0.5.dist-info/METADATA,sha256=d6J1f3gTeJaS90RwHDfPLuwPila1TzYFxbRInOqHqHM,735
|
46
|
+
h_ai_brain-0.0.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
47
|
+
h_ai_brain-0.0.5.dist-info/top_level.txt,sha256=3MChDBWvDJV4cEHuZhzeODxQ4ewtw-arOuyaDOc6sIo,5
|
48
|
+
h_ai_brain-0.0.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|