Skip to content
Merged
Show file tree
Hide file tree
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: 11 additions & 1 deletion PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

本计划把已核对的 DesireCore 接口整理成公开站点中的“集成与 API”区域。用户应能根据文档取得正确的服务地址和授权凭据,完成一次调用,理解响应与运行结果,并处理实际错误。实施采用主 Agent 协调、多个 subAgent 按接口能力并行核查、编写和验证的方式;先交付一个完整可用的接入流程,再按各项能力的实际进度发布扩展参考和 OpenAPI 下载。

状态:P0—P6 选定范围实施与发布验收完成。源码 #4798 已合并;文档 #72 及场景入口修复 #73 已合并并完成网站自动部署;16个API页面、8个下载和全站716URL线上验收通过。站内搜索已重抓更新,16个API页面的中英文标题、关键端点及浏览器弹窗验收通过。更新日期:2026-10-15。
状态:P0—P6 选定范围实施与发布验收完成。源码 #4798 已合并;文档 #72 及场景入口修复 #73 已合并并完成网站自动部署;16个API页面、8个下载和全站716URL线上验收通过。站内搜索已重抓更新,16个API页面和两篇旧更新日志搜索验收通过;已在免费额度内改为每日抓取,记录超大错误清零。更新日期:2026-10-15。

## 1. 实施目标与完成标准

Expand Down Expand Up @@ -493,3 +493,13 @@ P0—P5 表示工作范围,不能作为全局串行阶段。主 Agent 先完
沿现有配置手动抓取,于北京时间19:30:02开始、19:32:35结束,734个URL成功、2个内容类型忽略、2个旧v10.0.180中英文更新日志因记录过大失败。索引从19,324条更新至21,572条。未修改抓取周期,未发布编辑器草稿。中英文Webhook单页提取测试各生成110条记录。

正式搜索验收使用前端真实language/tag上下文过滤,16/16目标页面标题、4/4关键端点、2/2旧页对照全部命中,目标记录语言/current版本/标签均正确;中英文搜索弹窗均显示目标Webhook指南且点击可打开对应页面。首次命中排名1—19,不将索引覆盖误写成所有结果均排名第一。逐项证据见 `api/search-verification.json`,发布摘要已更新。

## 17. 免费每日抓取与旧日志修复(2026-10-15)

当前账单与现行DocSearch条款确认免费套餐每月包含5,000,000个抓取资源。按738URL每日一次、31天估算22,878,约0.46%,无需升级付费方案。已在既有crawler发布v5,将调度改为 `every 1 day`。

原v180中英文日志每页781条正文列表,其中同一修复标题下645条聚合导致单record约123KB,超过100,000字节限制。v5仅针对这两个精确路径,将每10条完整li在提取用DOM合成临时p,并关闭该页聚合;网页正文不变,标题/id、顺序及所有原文本保留,面包屑不参与分组。真实URLTester两页各89记录通过,英文API Webhook对照仍110记录。去密钥配置参考保存在 `api/algolia-crawler.config.js`。

v5正式抓取于北京时间20:43:47—20:46:35完成:736成功、2个内容类型忽略、0失败,索引21,572→21,750。两篇旧日志记录超大错误已清零。

30次搜索请求均HTTP200;API16标题、4端点、2旧页对照、2日志标题及4个日志中部/末尾正文目标通过。原2条带引号camelCase严格短语未命中保留为诊断;补查返回原始完整内容,未将负面诊断改写成通过。浏览器中文“存量明文”、英文“legacy sensitive results”均返回v180并可打开对应章节。完整费用、配置、文本保真与查询证据见 `api/search-daily-verification.json`。
16 changes: 11 additions & 5 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,23 @@ pnpm api:check -- --build

## 搜索索引维护

网站自动部署与 Algolia 索引更新是两个独立步骤。现有 DocSearch crawler 按月在每月 23 日运行,部署成功不能证明新增页面已经收录。当前使用应用 `68TB6NUYVW`、索引 `DesireCore Docs` 和 crawler `26591011-cca2-4aaa-9c75-75f1f0b3fad5`;周期时间以管理端显示为准。
网站自动部署与 Algolia 索引更新是两个独立步骤。现有 DocSearch crawler 已在管理端发布 v5,调度为 `every 1 day`(每日一次);部署成功不能证明新增页面已经收录。当前使用应用 `68TB6NUYVW`、索引 `DesireCore Docs` 和 crawler `26591011-cca2-4aaa-9c75-75f1f0b3fad5`;下次执行时间以管理端显示为准。

[去密钥配置参考](./algolia-crawler.config.js) 保存 v5 的路径、选择器、调度与索引设置,供审阅和后续维护。既有 Algolia 管理端保留认证,本仓不保存密钥;部署文档不自动应用此配置。`Crawler` 由 Algolia 配置运行环境提供,本地只需用 `node --check api/algolia-crawler.config.js` 检查语法,不把它作为站点脚本执行。

v5 只对 `/more/changelog/v10.0.180` 和 `/en/more/changelog/v10.0.180` 做定向分块:在爬虫内存中的 DOM 将每 10 条 `li` 合成一个临时 `p`,并关闭这两页的内容聚合。两页各 781 条原始列表均完整保留,网站正文不变;URL Tester 的 DocSearch helper 各产生 89 条记录,英文 Agent Webhook 对照页仍产生 110 条记录。其它页面保持原有提取方式。

2026-10-15 管理端账单显示当前使用免费的 DocSearch plan;[现行 DocSearch 条款](https://www.algolia.com/policies/docsearch-plan-specific-terms) 包含每月 5,000,000 个抓取资源额度。按上次全站 738 个 URL、每天完整抓取一次和 31 天估算,`738 × 31 = 22,878`,约占该额度的 `0.46%`。额外手动运行和站点增长另计;该估算不代替实际用量与套餐核对。

发布新增或调整后的 API 页面后,按以下步骤验收:

1. 先确认生产页面、canonical、robots、双语 sitemap 与正文正常。API 页应有可直接读取的 `.theme-doc-markdown`、标题及 `docsearch:language`、`docsearch:version`、`docsearch:docusaurus_tag` 元数据。
2. 在现有 crawler 的 URL Tester 中分别检查中英文页面的记录提取,再手动触发该 crawler 抓取。保留已保存配置和现有月度周期,不将编辑器草稿发布或新建密钥作为常规重抓步骤。
2. 在现有 crawler 的 URL Tester 中分别检查中英文页面的记录提取,再手动触发该 crawler 抓取。保留已保存配置和现有每日周期,不将编辑器草稿发布或新建密钥作为常规重抓步骤。
3. 等待该次抓取结束,记录时间、成功/忽略/失败 URL 数与索引记录数;检查失败原因,不能只看记录总数增长。先保留路径规则、选择器、调度等变量,只有抓取证据指向具体配置问题时再处理该项。
4. 按站点实际过滤条件查询:中文 `language:zh-Hans`、英文 `language:en`,并使用 `docusaurus_tag:default OR docs-default-current`。逐项检查 16 个双语 API 页面标题、代表性端点和两种语言的旧页面对照,确认返回目标 URL、`current` 版本和正确 tag;结果排名不要求固定第一。
5. 在网站搜索框分别查找“智能体 Webhook”和“Agent Webhook”,打开目标页面,再更新 [搜索验收记录](./search-verification.json)。公开记录只保留必要的时间、配置、查询与结果证据,不保存密钥、账号身份、请求头或本机绝对路径。
5. 在网站搜索框分别查找“智能体 Webhook”和“Agent Webhook”,打开目标页面,再更新 [每日调度与分块验收记录](./search-daily-verification.json)。公开记录只保留必要的时间、配置、查询与结果证据,不保存密钥、账号身份、请求头或本机绝对路径。

2026-10-15 的手动抓取使索引从 19,324 条增至 21,572 条,22 项查询及双语浏览器检查通过。该次抓取仍有两篇 `v10.0.180` 更新日志因记录过大而失败;API 搜索验收通过不等于全站抓取没有失败。完整结果见搜索验收记录。
首次收录时的 [v4 搜索验收记录](./search-verification.json) 保留当时的月度调度快照:2026-10-15 手动抓取使索引从 19,324 条增至 21,572 条,22 项查询及双语浏览器检查通过,但两篇 `v10.0.180` 更新日志因记录过大而失败。该历史记录不随 v5 改写;每日调度、定向分块和后续真实抓取结果单独记录,URL Tester 通过不等于整站抓取已全部通过。

## 清单字段

Expand Down Expand Up @@ -78,4 +84,4 @@ pnpm api:check -- --build

## 当前验证记录

参见 [核查与验证](./verification.md)、[发布与验收摘要](./publication.json)、[生产逐项报告](./production-verification.json)及[搜索验收记录](./search-verification.json)。后续更改认证、路由、配置入口或结果交付时,只重新核对受影响合同和相关示例,不将本批测试结果传播为其它功能的运行保证。
参见 [核查与验证](./verification.md)、[发布与验收摘要](./publication.json)、[生产逐项报告](./production-verification.json)、[首次搜索验收记录](./search-verification.json)及[每日调度与分块验收记录](./search-daily-verification.json)。后续更改认证、路由、配置入口或结果交付时,只重新核对受影响合同和相关示例,不将本批测试结果传播为其它功能的运行保证。
120 changes: 120 additions & 0 deletions api/algolia-crawler.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
// Algolia 管理端已发布 v5 的去密钥配置参考,供审阅和后续维护。
// 既有 Algolia 管理端保留认证,本仓不保存密钥;部署文档不自动应用此配置。
// Crawler 由 Algolia 配置运行环境提供;本文件不在站点构建中执行。
/* global Crawler */

new Crawler({
appId: "68TB6NUYVW",
indexPrefix: "",
rateLimit: 8,
maxDepth: 10,
maxUrls: null,
schedule: "every 1 day",
startUrls: ["https://docs.desirecore.com"],
renderJavaScript: false,
sitemaps: ["https://docs.desirecore.com/sitemap.xml"],
ignoreCanonicalTo: true,
discoveryPatterns: ["https://docs.desirecore.com/**"],
actions: [
{
indexName: "DesireCore Docs",
pathsToMatch: ["https://docs.desirecore.com/**"],
recordExtractor: ({ url, $, helpers }) => {
const lvl0 =
$(
".menu__link.menu__link--sublist.menu__link--active, .navbar__item.navbar__link--active",
)
.last()
.text() || "Documentation";
const splitChangelog = /^\/(?:en\/)?more\/changelog\/v10\.0\.180\/?$/.test(url.pathname);
if (splitChangelog) {
$("article .theme-doc-markdown ul").each((_, list) => {
const items = $(list).children("li").toArray();
for (let i = 0; i < items.length; i += 10) {
const html = items.slice(i, i + 10)
.map((item) => $(item).html() || "").join("\n");
$(list).before($("<p></p>").html(html));
}
$(list).remove();
});
}
return helpers.docsearch({
recordProps: {
lvl0: {
selectors: "",
defaultValue: lvl0,
},
lvl1: ["header h1", "article h1"],
lvl2: "article h2",
lvl3: "article h3",
lvl4: "article h4",
lvl5: "article h5, article td:first-child",
lvl6: "article h6",
content: "article p, article li, article td:last-child",
},
aggregateContent: !splitChangelog,
recordVersion: "v3",
});
},
},
],
safetyChecks: { beforeIndexPublishing: { maxLostRecordsPercentage: 30 } },
initialIndexSettings: {
"DesireCore Docs": {
attributesForFaceting: [
"type",
"lang",
"language",
"version",
"docusaurus_tag",
],
attributesToRetrieve: [
"hierarchy",
"content",
"anchor",
"url",
"url_without_anchor",
"type",
],
attributesToHighlight: ["hierarchy", "content"],
attributesToSnippet: ["content:10"],
camelCaseAttributes: ["hierarchy", "content"],
searchableAttributes: [
"unordered(hierarchy.lvl0)",
"unordered(hierarchy.lvl1)",
"unordered(hierarchy.lvl2)",
"unordered(hierarchy.lvl3)",
"unordered(hierarchy.lvl4)",
"unordered(hierarchy.lvl5)",
"unordered(hierarchy.lvl6)",
"content",
],
distinct: true,
attributeForDistinct: "url",
customRanking: [
"desc(weight.pageRank)",
"desc(weight.level)",
"asc(weight.position)",
],
ranking: [
"words",
"filters",
"typo",
"attribute",
"proximity",
"exact",
"custom",
],
highlightPreTag: '<span class="algolia-docsearch-suggestion--highlight">',
highlightPostTag: "</span>",
minWordSizefor1Typo: 3,
minWordSizefor2Typos: 7,
allowTyposOnNumericTokens: false,
minProximity: 1,
ignorePlurals: true,
advancedSyntax: true,
attributeCriteriaComputedByMinProximity: true,
removeWordsIfNoResults: "allOptional",
},
},
});
57 changes: 41 additions & 16 deletions api/publication.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"recordedAt": "2026-10-15T09:10:42.184Z",
"recordedAt": "2026-10-15T12:53:07.064Z",
"productionOrigin": "https://docs.desirecore.com",
"source": {
"pullRequest": "https://github.com/desirecore/desirecore/pull/4798",
Expand Down Expand Up @@ -64,19 +64,19 @@
}
},
"search": {
"checkedAt": "2026-10-15T11:34:17.100Z",
"checkedAt": "2026-10-15T12:53:07.064Z",
"status": "passed",
"rootCause": "The existing crawler runs on the 23rd day of each month; the previous complete crawl was on 2026-09-23, before API publication.",
"crawlerId": "26591011-cca2-4aaa-9c75-75f1f0b3fad5",
"schedule": "on the 23 day of the month",
"schedule": "every 1 day",
"manualCrawl": {
"startedAt": "2026-10-15T11:30:02Z",
"completedAt": "2026-10-15T11:32:35Z",
"successUrls": 734,
"startedAt": "2026-10-15T12:43:47Z",
"completedAt": "2026-10-15T12:46:35Z",
"successUrls": 736,
"ignoredUrls": 2,
"failedUrls": 2,
"recordsBefore": 19324,
"recordsAfter": 21572
"failedUrls": 0,
"recordsBefore": 21572,
"recordsAfter": 21750
},
"titleTargets": 16,
"titleTargetsMatched": 16,
Expand All @@ -86,15 +86,40 @@
"legacyControlsPassed": 2,
"contextualFilter": "language:<locale> AND (docusaurus_tag:default OR docusaurus_tag:docs-default-current)",
"browserChecks": {
"zhQuery": "智能体 Webhook",
"enQuery": "Agent Webhook",
"targetLinksOpened": true
"apiGuides": "Previously passed Chinese/English Webhook checks.",
"changelogGuides": {
"passed": true,
"checks": [
{
"locale": "zh-Hans",
"query": "存量明文",
"openedUrl": "https://docs.desirecore.com/more/changelog/v10.0.180#%E4%BF%AE%E5%A4%8D",
"heading": "DesireCore v10.0.180"
},
{
"locale": "en",
"query": "legacy sensitive results",
"openedUrl": "https://docs.desirecore.com/en/more/changelog/v10.0.180#bug-fixes",
"heading": "DesireCore v10.0.180"
}
],
"meaning": "The actual website search modal returned the changelog content and the selected result opened the correct language page and section."
}
},
"details": "search-verification.json",
"details": "search-daily-verification.json",
"limitations": [
"The monthly schedule is unchanged; website deployment does not itself trigger this external crawler.",
"The two oversized-record failures concern the Chinese and English v10.0.180 changelog pages, not API pages."
]
"The free allowance estimate uses the current 738-URL site size; extra manual crawls and growth count toward usage.",
"Two strict quoted camelCase phrase probes returned no hits; separate targeted rechecks returned the full expected source content. Diagnostic misses are retained and not counted as passed queries."
],
"configurationVersion": 5,
"freeDailyPlan": {
"name": "DocSearch",
"monthlyCrawledResources": 5000000,
"estimatedMonthlyCrawledResourcesAt31Days": 22878,
"termsUrl": "https://www.algolia.com/policies/docsearch-plan-specific-terms"
},
"changelogTitleChecksPassed": 2,
"changelogBodyTargetsVerified": 4
},
"limitations": [
"No commercial model, packaged-client or production business-operation acceptance is inferred from this documentation deployment.",
Expand Down
Loading
Loading