feat: Implement auto-linked content updates in wiki page management

- Introduced UpdateAutoLinkedContent method to persist changes from machine-only link decorators without incrementing the version number, ensuring user-facing revisions remain consistent.
- Updated existing methods to utilize the new auto-linked content update logic, enhancing the handling of cross-link injection and dead-link cleanup.
- Enhanced the KnowledgeBase and WikiBrowser components to improve user experience during wiki operations, including status tracking and indexing indicators.
- Added scheduling for wiki status probes to provide timely feedback on indexing processes after user-triggered actions.
This commit is contained in:
wizardchen
2026-04-23 11:16:47 +08:00
parent d305d5eb7c
commit c5494f612b
7 changed files with 119 additions and 5 deletions
+16
View File
@@ -27,6 +27,15 @@ type WikiPageService interface {
// ref changes driven by internal reconciliation.
UpdatePageMeta(ctx context.Context, page *types.WikiPage) error
// UpdateAutoLinkedContent persists content changes that come from
// machine-only link decoration — cross-link injection and dead-link
// cleanup — without bumping `version`. Out-links are re-parsed from the
// new body and bidirectional in-link references on target pages are
// refreshed. Conceptually the body still represents the same revision
// the user saw before, just with wiki-link markup added or stripped, so
// surfacing a version bump to end users is misleading.
UpdateAutoLinkedContent(ctx context.Context, page *types.WikiPage) error
// GetPageBySlug retrieves a wiki page by its slug within a knowledge base.
GetPageBySlug(ctx context.Context, kbID string, slug string) (*types.WikiPage, error)
@@ -103,6 +112,13 @@ type WikiPageRepository interface {
// unchanged body, and status-only transitions.
UpdateMeta(ctx context.Context, page *types.WikiPage) error
// UpdateAutoLinkedContent rewrites `content`, `out_links` and
// `updated_at` in place while leaving `version` untouched. Intended for
// machine-only link markup changes (cross-link injection / dead-link
// cleanup) so the first-ingest page doesn't jump to v2 just because the
// post-processor added a `[[...]]` wrapper.
UpdateAutoLinkedContent(ctx context.Context, page *types.WikiPage) error
// GetByID retrieves a wiki page by its unique ID.
GetByID(ctx context.Context, id string) (*types.WikiPage, error)