refactor: Remove agent_test command-line tool and associated files to streamline project structure and eliminate unused components

This commit is contained in:
wizardchen
2025-12-01 17:24:57 +08:00
parent 60241a2d29
commit 93af4460d6
40 changed files with 387 additions and 1692 deletions
+3 -35
View File
@@ -98,6 +98,7 @@ func (t *GetDocumentInfoTool) Execute(ctx context.Context, args map[string]inter
}
}
// Check if knowledge IDs are valid
if len(knowledgeIDs) == 0 {
return &types.ToolResult{
Success: false,
@@ -116,6 +117,7 @@ func (t *GetDocumentInfoTool) Execute(ctx context.Context, args map[string]inter
var mu sync.Mutex
results := make(map[string]*docInfo)
// Concurrently get info for each knowledge ID
for _, knowledgeID := range knowledgeIDs {
wg.Add(1)
go func(id string) {
@@ -195,10 +197,7 @@ func (t *GetDocumentInfoTool) Execute(ctx context.Context, args map[string]inter
for i, doc := range successDocs {
k := doc.knowledge
// Get file type icon
typeIcon := getTypeIcon(k.Type, k.FileType)
output += fmt.Sprintf("【文档 #%d】 %s\n", i+1, typeIcon)
output += fmt.Sprintf("【文档 #%d】\n", i+1)
output += fmt.Sprintf(" ID: %s\n", k.ID)
output += fmt.Sprintf(" 标题: %s\n", k.Title)
@@ -240,7 +239,6 @@ func (t *GetDocumentInfoTool) Execute(ctx context.Context, args map[string]inter
"parse_status": k.ParseStatus,
"chunk_count": doc.chunkCount,
"metadata": k.GetMetadata(),
"type_icon": typeIcon,
})
}
@@ -264,36 +262,6 @@ func (t *GetDocumentInfoTool) Execute(ctx context.Context, args map[string]inter
}, nil
}
// Helper functions
func getTypeIcon(knowledgeType, fileType string) string {
switch knowledgeType {
case "file":
switch fileType {
case "pdf", "PDF":
return "📄 PDF"
case "docx", "doc", "DOCX", "DOC":
return "📝 Word"
case "txt", "TXT":
return "📃 Text"
case "md", "MD", "markdown":
return "📋 Markdown"
case "xlsx", "xls", "XLSX", "XLS":
return "📊 Excel"
case "pptx", "ppt", "PPTX", "PPT":
return "📊 PowerPoint"
default:
return "📄 File"
}
case "url":
return "🌐 URL"
case "passage":
return "📝 Passage"
default:
return "📄 Document"
}
}
func formatSource(knowledgeType, source string) string {
switch knowledgeType {
case "file":