feat: Enhance Wiki Fixer agent with improved issue handling and UI updates
- Updated the agent system prompt to refine the workflow for fixing issues, emphasizing the need to verify if issues still exist before making edits. - Introduced a new `embeddedMode` prop in the frontend components to manage UI behavior based on the context of use. - Simplified issue fix prompts in multiple languages for clarity, ensuring users receive concise instructions for resolving issues. - Enhanced the WikiBrowser component to improve the display of issues and actions, including updated icons and streamlined interaction elements. These changes significantly improve the user experience and functionality of the Wiki Fixer agent, fostering more efficient issue resolution and content management.
This commit is contained in:
@@ -13,12 +13,13 @@ import (
|
||||
|
||||
type wikiWritePageTool struct {
|
||||
BaseTool
|
||||
wikiPageService interfaces.WikiPageService
|
||||
kbIDs []string
|
||||
wikiPageService interfaces.WikiPageService
|
||||
knowledgeService interfaces.KnowledgeService
|
||||
kbIDs []string
|
||||
}
|
||||
|
||||
// NewWikiWritePageTool creates a new wiki_write_page tool
|
||||
func NewWikiWritePageTool(wikiPageService interfaces.WikiPageService, kbIDs []string) types.Tool {
|
||||
func NewWikiWritePageTool(wikiPageService interfaces.WikiPageService, kbIDs []string, knowledgeService interfaces.KnowledgeService) types.Tool {
|
||||
return &wikiWritePageTool{
|
||||
BaseTool: NewBaseTool(
|
||||
ToolWikiWritePage,
|
||||
@@ -54,14 +55,15 @@ func NewWikiWritePageTool(wikiPageService interfaces.WikiPageService, kbIDs []st
|
||||
"source_refs": {
|
||||
"type": "array",
|
||||
"items": {"type": "string"},
|
||||
"description": "A list of source knowledge IDs that contributed to this page. If provided, these will COMPLETELY REPLACE the existing source_refs of the page."
|
||||
"description": "A list of source knowledge IDs (UUIDs only) that contributed to this page. If provided, these will COMPLETELY REPLACE the existing source_refs of the page."
|
||||
}
|
||||
},
|
||||
"required": ["slug", "title", "summary", "content", "page_type"]
|
||||
}`),
|
||||
),
|
||||
wikiPageService: wikiPageService,
|
||||
kbIDs: kbIDs,
|
||||
wikiPageService: wikiPageService,
|
||||
knowledgeService: knowledgeService,
|
||||
kbIDs: kbIDs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +97,8 @@ func (t *wikiWritePageTool) Execute(ctx context.Context, args json.RawMessage) (
|
||||
return &types.ToolResult{Success: false, Error: "Failed to check existing page: " + err.Error()}, nil
|
||||
}
|
||||
|
||||
resolvedRefs := resolveSourceRefs(ctx, t.knowledgeService, params.SourceRefs)
|
||||
|
||||
var action string
|
||||
if existingPage != nil {
|
||||
// Update
|
||||
@@ -104,8 +108,8 @@ func (t *wikiWritePageTool) Execute(ctx context.Context, args json.RawMessage) (
|
||||
existingPage.PageType = params.PageType
|
||||
existingPage.Aliases = params.Aliases
|
||||
|
||||
if len(params.SourceRefs) > 0 {
|
||||
existingPage.SourceRefs = params.SourceRefs
|
||||
if len(resolvedRefs) > 0 {
|
||||
existingPage.SourceRefs = resolvedRefs
|
||||
}
|
||||
|
||||
_, err = t.wikiPageService.UpdatePage(ctx, existingPage)
|
||||
@@ -123,7 +127,7 @@ func (t *wikiWritePageTool) Execute(ctx context.Context, args json.RawMessage) (
|
||||
Content: params.Content,
|
||||
PageType: params.PageType,
|
||||
Aliases: params.Aliases,
|
||||
SourceRefs: params.SourceRefs,
|
||||
SourceRefs: resolvedRefs,
|
||||
}
|
||||
_, err = t.wikiPageService.CreatePage(ctx, newPage)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user