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:
@@ -95,5 +95,20 @@ func (t *wikiReplaceTextTool) Execute(ctx context.Context, args json.RawMessage)
|
||||
return &types.ToolResult{Success: false, Error: "Failed to update page: " + err.Error()}, nil
|
||||
}
|
||||
|
||||
return &types.ToolResult{Success: true, Output: fmt.Sprintf("Successfully replaced text on page %s.", params.Slug)}, nil
|
||||
oldPreview := truncateRunes(params.OldText, 80)
|
||||
newPreview := truncateRunes(params.NewText, 80)
|
||||
|
||||
output := fmt.Sprintf("Successfully replaced text on page [[%s]].\n- Old: %s\n- New: %s", params.Slug, oldPreview, newPreview)
|
||||
|
||||
return &types.ToolResult{
|
||||
Success: true,
|
||||
Output: output,
|
||||
Data: map[string]interface{}{
|
||||
"display_type": "wiki_replace_text",
|
||||
"slug": params.Slug,
|
||||
"title": existingPage.Title,
|
||||
"old_text": oldPreview,
|
||||
"new_text": newPreview,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user