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
+2 -1
View File
@@ -43,7 +43,8 @@ type ChunkRepository interface {
CountChunksByKnowledgeBaseID(ctx context.Context, tenantID uint64, kbID string) (int64, error)
// DeleteUnindexedChunks deletes unindexed chunks by knowledge id and chunk index range
DeleteUnindexedChunks(ctx context.Context, tenantID uint64, knowledgeID string) ([]*types.Chunk, error)
// ListAllFAQChunksByKnowledgeID lists all FAQ chunks for a knowledge ID (only ID and ContentHash fields for efficiency)
// ListAllFAQChunksByKnowledgeID lists all FAQ chunks for a knowledge ID
// only ID and ContentHash fields for efficiency
ListAllFAQChunksByKnowledgeID(ctx context.Context, tenantID uint64, knowledgeID string) ([]*types.Chunk, error)
}
+2
View File
@@ -6,6 +6,8 @@ import (
"github.com/hibiken/asynq"
)
// Extracter is a interface for extracting entities
type Extracter interface {
// Extract extracts entities from a task
Extract(ctx context.Context, t *asynq.Task) error
}
+2 -1
View File
@@ -46,6 +46,7 @@ type ModelRepository interface {
Update(ctx context.Context, model *types.Model) error
// Delete deletes a model
Delete(ctx context.Context, tenantID uint64, id string) error
// ClearDefaultByType clears the default flag for all models of a specific type, optionally excluding a specific model ID
// ClearDefaultByType clears the default flag for all models of a specific type
// optionally excluding a specific model ID.
ClearDefaultByType(ctx context.Context, tenantID uint, modelType types.ModelType, excludeID string) error
}
@@ -6,8 +6,12 @@ import (
"github.com/Tencent/WeKnora/internal/types"
)
// RetrieveGraphRepository is a repository for retrieving graphs
type RetrieveGraphRepository interface {
// AddGraph adds a graph to the repository
AddGraph(ctx context.Context, namespace types.NameSpace, graphs []*types.GraphData) error
// DelGraph deletes a graph from the repository
DelGraph(ctx context.Context, namespace []types.NameSpace) error
// SearchNode searches for nodes in the repository
SearchNode(ctx context.Context, namespace types.NameSpace, nodes []string) (*types.GraphData, error)
}
+4 -2
View File
@@ -32,7 +32,8 @@ type SessionService interface {
// webSearchEnabled: whether to enable web search to supplement knowledge base results
// Events are emitted through eventBus (references, answer chunks, completion)
KnowledgeQA(ctx context.Context,
session *types.Session, query string, knowledgeBaseIDs []string, assistantMessageID string, summaryModelID string, webSearchEnabled bool, eventBus *event.EventBus,
session *types.Session, query string, knowledgeBaseIDs []string,
assistantMessageID string, summaryModelID string, webSearchEnabled bool, eventBus *event.EventBus,
) error
// KnowledgeQAByEvent performs knowledge-based question answering by event
KnowledgeQAByEvent(ctx context.Context, chatManage *types.ChatManage, eventList []types.EventType) error
@@ -62,7 +63,8 @@ type SessionService interface {
seenURLs map[string]bool,
knowledgeIDs []string,
)
// DeleteWebSearchTempKBState deletes the temporary KB state for web search from Redis and cleans up associated knowledge base and knowledge items
// DeleteWebSearchTempKBState deletes the temporary KB state for web search from Redis
// and cleans up associated knowledge base and knowledge items
DeleteWebSearchTempKBState(ctx context.Context, sessionID string) error
}
+7 -1
View File
@@ -8,12 +8,18 @@ import (
// WebSearchProvider defines the interface for web search providers
type WebSearchProvider interface {
Search(ctx context.Context, query string, maxResults int, includeDate bool) ([]*types.WebSearchResult, error)
// Name returns the name of the provider
Name() string
// Search performs a web search
Search(ctx context.Context, query string, maxResults int, includeDate bool) ([]*types.WebSearchResult, error)
}
// WebSearchService defines the interface for web search services
type WebSearchService interface {
// Search performs a web search
Search(ctx context.Context, config *types.WebSearchConfig, query string) ([]*types.WebSearchResult, error)
// CompressWithRAG performs RAG-based compression using a temporary, hidden knowledge base
// The temporary knowledge base is deleted after use. The UI will not list it due to repo filtering.
CompressWithRAG(ctx context.Context, sessionID string, tempKBID string, questions []string,
webSearchResults []*types.WebSearchResult, cfg *types.WebSearchConfig,
kbSvc KnowledgeBaseService, knowSvc KnowledgeService,