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:
@@ -58,6 +58,15 @@ type WikiPageService interface {
|
||||
|
||||
// SearchPages performs full-text search over wiki pages.
|
||||
SearchPages(ctx context.Context, kbID string, query string, limit int) ([]*types.WikiPage, error)
|
||||
|
||||
// CreateIssue logs a new issue for a wiki page.
|
||||
CreateIssue(ctx context.Context, issue *types.WikiPageIssue) (*types.WikiPageIssue, error)
|
||||
|
||||
// ListIssues retrieves issues for a knowledge base, optionally filtered by slug and status.
|
||||
ListIssues(ctx context.Context, kbID string, slug string, status string) ([]*types.WikiPageIssue, error)
|
||||
|
||||
// UpdateIssueStatus updates the status of an issue (e.g. pending -> resolved/ignored).
|
||||
UpdateIssueStatus(ctx context.Context, issueID string, status string) error
|
||||
}
|
||||
|
||||
// WikiPageRepository defines the wiki page data persistence interface.
|
||||
@@ -103,4 +112,13 @@ type WikiPageRepository interface {
|
||||
|
||||
// CountOrphans returns the number of pages with no inbound links.
|
||||
CountOrphans(ctx context.Context, kbID string) (int64, error)
|
||||
|
||||
// CreateIssue inserts a new wiki page issue record.
|
||||
CreateIssue(ctx context.Context, issue *types.WikiPageIssue) error
|
||||
|
||||
// ListIssues retrieves issues with optional filtering by slug and status.
|
||||
ListIssues(ctx context.Context, kbID string, slug string, status string) ([]*types.WikiPageIssue, error)
|
||||
|
||||
// UpdateIssueStatus updates an issue's status.
|
||||
UpdateIssueStatus(ctx context.Context, issueID string, status string) error
|
||||
}
|
||||
|
||||
@@ -171,3 +171,25 @@ type WikiStats struct {
|
||||
PendingTasks int64 `json:"pending_tasks"` // number of documents waiting to be ingested
|
||||
IsActive bool `json:"is_active"` // whether wiki ingestion is currently running
|
||||
}
|
||||
|
||||
// WikiPageIssue represents an issue flagged on a specific wiki page.
|
||||
// These issues are typically identified by agents or linters and stored for review.
|
||||
type WikiPageIssue struct {
|
||||
ID string `json:"id" gorm:"type:varchar(36);primaryKey"`
|
||||
TenantID uint64 `json:"tenant_id" gorm:"index"`
|
||||
KnowledgeBaseID string `json:"knowledge_base_id" gorm:"type:varchar(36);index"`
|
||||
Slug string `json:"slug" gorm:"type:varchar(255);index"`
|
||||
IssueType string `json:"issue_type" gorm:"type:varchar(50)"`
|
||||
Description string `json:"description" gorm:"type:text"`
|
||||
SuspectedKnowledgeIDs StringArray `json:"suspected_knowledge_ids" gorm:"type:json"`
|
||||
Status string `json:"status" gorm:"type:varchar(20);default:'pending';index"`
|
||||
ReportedBy string `json:"reported_by" gorm:"type:varchar(100)"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"index"`
|
||||
}
|
||||
|
||||
// TableName specifies the database table name
|
||||
func (WikiPageIssue) TableName() string {
|
||||
return "wiki_page_issues"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user