fix(knowledge_fs): refactor crawl page import logic to handle missing pages

This commit is contained in:
FFXN 2026-08-07 16:55:05 +08:00
parent 6c47ee52eb
commit cbecb64fef
2 changed files with 9 additions and 10 deletions

View File

@ -847,10 +847,7 @@ describe("source-product workflow provider imports", () => {
},
inventory: [],
run: providerRun(source.id, "crawl-import", {
selectedSourceUrls: [
"https://example.test/selected",
"https://example.test/missing",
],
selectedSourceUrls: ["https://example.test/selected", "https://example.test/missing"],
}),
source,
websiteCrawl: {

View File

@ -793,12 +793,14 @@ async function processSelectedCrawlImport(
state: "importing",
}),
);
await importCrawlPages(
input,
execution,
source,
[...requestedUrls].map((sourceUrl) => matched.get(sourceUrl)!),
);
const selectedPages = [...requestedUrls].map((sourceUrl) => {
const page = matched.get(sourceUrl);
if (!page) {
throw runtimeError("SOURCE_CRAWL_PAGE_NOT_FOUND", "Selected crawl page is unavailable");
}
return page;
});
await importCrawlPages(input, execution, source, selectedPages);
}
async function importCrawlPages(