feat(knowledge): offload manual processing to async tasks
This commit is contained in:
@@ -13,6 +13,7 @@ const (
|
||||
TypeKnowledgeMove = "knowledge:move" // 知识移动任务
|
||||
TypeDataTableSummary = "datatable:summary" // 表格摘要任务
|
||||
TypeImageMultimodal = "image:multimodal" // 图片多模态处理任务(OCR + VLM Caption)
|
||||
TypeManualProcess = "manual:process" // 手工知识更新任务(cleanup + 重新索引)
|
||||
)
|
||||
|
||||
// ExtractChunkPayload represents the extract chunk task payload
|
||||
@@ -126,6 +127,17 @@ type KnowledgeMoveProgress struct {
|
||||
UpdatedAt int64 `json:"updated_at"` // 最后更新时间
|
||||
}
|
||||
|
||||
// ManualProcessPayload represents the manual knowledge processing task payload.
|
||||
// Used for both create (publish) and update operations.
|
||||
type ManualProcessPayload struct {
|
||||
RequestId string `json:"request_id"`
|
||||
TenantID uint64 `json:"tenant_id"`
|
||||
KnowledgeID string `json:"knowledge_id"`
|
||||
KnowledgeBaseID string `json:"knowledge_base_id"`
|
||||
Content string `json:"content"` // cleaned markdown content
|
||||
NeedCleanup bool `json:"need_cleanup"` // true for update, false for create
|
||||
}
|
||||
|
||||
// ImageMultimodalPayload represents the image multimodal processing task payload.
|
||||
type ImageMultimodalPayload struct {
|
||||
TenantID uint64 `json:"tenant_id"`
|
||||
|
||||
@@ -129,6 +129,8 @@ type KnowledgeService interface {
|
||||
UpdateFAQEntryTagBatch(ctx context.Context, kbID string, updates map[int64]*int64) error
|
||||
// GetRepository gets the knowledge repository
|
||||
GetRepository() KnowledgeRepository
|
||||
// ProcessManualUpdate handles Asynq manual knowledge update tasks (cleanup + re-indexing)
|
||||
ProcessManualUpdate(ctx context.Context, t *asynq.Task) error
|
||||
// ProcessDocument handles Asynq document processing tasks
|
||||
ProcessDocument(ctx context.Context, t *asynq.Task) error
|
||||
// ProcessFAQImport handles Asynq FAQ import tasks
|
||||
|
||||
Reference in New Issue
Block a user