feat: Introduce wiki_flag_issue tool for reporting wiki page issues

- Added a new tool, `wiki_flag_issue`, enabling users to report factual errors, mixed entities, or outdated information on wiki pages.
- Updated the agent system prompt and tool definitions to include the new tool, enhancing the agent's capabilities for maintaining wiki accuracy.
- Implemented backend functionality for creating, listing, and updating the status of flagged issues, ensuring effective tracking and resolution.

These changes significantly improve the agent's ability to manage and report issues within the wiki, fostering a more reliable knowledge base.
This commit is contained in:
wizardchen
2026-04-10 11:58:22 +08:00
parent 9d13082f29
commit 5dd4b9f2ee
13 changed files with 302 additions and 0 deletions
@@ -292,3 +292,29 @@ func (r *wikiPageRepository) CountOrphans(ctx context.Context, kbID string) (int
}
return count, nil
}
func (r *wikiPageRepository) CreateIssue(ctx context.Context, issue *types.WikiPageIssue) error {
return r.db.WithContext(ctx).Create(issue).Error
}
func (r *wikiPageRepository) ListIssues(ctx context.Context, kbID string, slug string, status string) ([]*types.WikiPageIssue, error) {
query := r.db.WithContext(ctx).Where("knowledge_base_id = ?", kbID)
if slug != "" {
query = query.Where("slug = ?", slug)
}
if status != "" {
query = query.Where("status = ?", status)
}
var issues []*types.WikiPageIssue
if err := query.Order("created_at DESC").Find(&issues).Error; err != nil {
return nil, err
}
return issues, nil
}
func (r *wikiPageRepository) UpdateIssueStatus(ctx context.Context, issueID string, status string) error {
return r.db.WithContext(ctx).Model(&types.WikiPageIssue{}).
Where("id = ?", issueID).
Update("status", status).Error
}