Repository navigation
ServiceStack.AI.Chat 10.2.0 - Gemini web crawl only saves the start page: link scope is checked against each page's path, not the start URL #159
Closed
colby02184
started this conversation in
Ideas
Replies: 1 comment 1 reply
|
Thanks for the report, I've added a fix for this in ServiceStack/ServiceStack@00db6f0 This change is now available in the pre-release packages. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The Gemini extension's web crawler (/ext/gemini/imports/crawl) only follows links that sit underneath the page they were found on. On documentation sites with flat .html pages, the crawl stops after the start page no matter which settings are used (Max pages, Max depth, Include paths, etc.).
I'm on ServiceStack.AI.Chat 10.2.0 and used these settings:
Admin → Gemini → Import → Web crawl, default settings (Max pages 500, Max depth 10, Include /**
) Start URL:https://doc.sitecore.com/sai/en/developers/sitecoreai/sitecoreai.htmlI was expecting the crawler to follow at least 24 pages under /sai/en/developers/sitecoreai/, e.g .../sitecoreai/experience-edge.html, but it only crawled one page. The site isn't blocking it though, the raw HTML has the links robots.txt allows /, the canonical tag matches the URL, and the site returns 200 to the llms-gemini-crawler/1.0 user agent.
Cause
In
GeminiCrawlRoutes.cs,CanonicalUrl(raw, start, options)uses itsstartargument for two things: resolving relative links and the scope check:But discovered links are passed the current page, not the crawl's start URL:
That causes two problems:
/docs/intro.htmlscopes the crawl to/docs/intro.html/..., so/docs/setup.htmlis rejected./docs/and reaching/docs/ameans a link from/docs/ato/docs/bis rejected. The crawl can only go deeper, never sideways.Starting from a folder URL doesn't help on sites like this one, because
.../sitecoreai/redirects to.../sitecoreai.html.The Python original has the same logic (
llms/extensions/gemini/crawl.pycanonical_url, called withfinal_urlfor discovered links), so it's probably affected too.Suggested fix
Resolve each link against the page it was found on, but always check scope against the start URL. When the start URL ends in a file name, scope to its folder:
/docsand/docs/start URLs keep their current scope. Only a start URL that ends in a file name gets the wider, folder-level scope.I have a patch with a regression test (a start page linking to a sibling page, which links to a nested page, plus an out-of-scope link) and I'm happy to open a PR if that's welcome.
All reactions