feat: Implement wiki editing functionalities and UI components

- Added new tools for wiki page editing, including writing, replacing text, renaming, and deleting pages, with corresponding data structures for each action.
- Enhanced the frontend with a new `WikiEditResult` component to display results of wiki edits, supporting multiple languages for improved accessibility.
- Updated localization files for English and Chinese to include new strings related to wiki actions.
- Modified existing tools to return structured data for wiki actions, improving the clarity and usability of the output messages.

These changes significantly enhance the wiki editing capabilities, providing users with a more robust and user-friendly experience when managing wiki content.
This commit is contained in:
wizardchen
2026-04-10 21:35:28 +08:00
parent 995e2157cd
commit 84edfa5439
10 changed files with 483 additions and 11 deletions
+14 -3
View File
@@ -134,10 +134,21 @@ func (t *wikiRenamePageTool) Execute(ctx context.Context, args json.RawMessage)
// Rebuild the index page to reflect the new/updated summary
_ = t.wikiPageService.RebuildIndexPage(ctx, kbID)
outputMsg := fmt.Sprintf("Successfully renamed page %s to %s and updated %d incoming links.", params.Slug, params.NewSlug, updatedCount)
outputMsg := fmt.Sprintf("Successfully renamed page [[%s]] → [[%s]] and updated %d incoming links.", params.Slug, params.NewSlug, updatedCount)
if updatedCount > 0 {
outputMsg += fmt.Sprintf(" Affected pages: %s", strings.Join(updatedSlugs, ", "))
outputMsg += fmt.Sprintf("\n- Affected pages: %s", strings.Join(updatedSlugs, ", "))
}
return &types.ToolResult{Success: true, Output: outputMsg}, nil
return &types.ToolResult{
Success: true,
Output: outputMsg,
Data: map[string]interface{}{
"display_type": "wiki_rename_page",
"old_slug": params.Slug,
"new_slug": params.NewSlug,
"title": existingPage.Title,
"updated_count": updatedCount,
"affected_pages": updatedSlugs,
},
}, nil
}