feat(knowledge): Add tag_id support for knowledge creation and file uploads

- Introduced tag_id parameter in various knowledge-related API functions to allow categorization of knowledge entries.
- Updated frontend components to handle tag_id during knowledge creation and file uploads.
- Enhanced UI store to manage the selected tag ID for better user experience in categorizing knowledge.
This commit is contained in:
Xia Dong
2026-01-14 18:51:12 +08:00
committed by begoniezhao
parent 6c90480e82
commit cec722aa43
10 changed files with 178 additions and 124 deletions
+4
View File
@@ -12,6 +12,7 @@ import (
// KnowledgeService defines the interface for knowledge services.
type KnowledgeService interface {
// CreateKnowledgeFromFile creates knowledge from a file.
// tagID is optional - when provided, the file will be assigned to the specified tag/category.
CreateKnowledgeFromFile(
ctx context.Context,
kbID string,
@@ -19,14 +20,17 @@ type KnowledgeService interface {
metadata map[string]string,
enableMultimodel *bool,
customFileName string,
tagID string,
) (*types.Knowledge, error)
// CreateKnowledgeFromURL creates knowledge from a URL.
// tagID is optional - when provided, the knowledge will be assigned to the specified tag/category.
CreateKnowledgeFromURL(
ctx context.Context,
kbID string,
url string,
enableMultimodel *bool,
title string,
tagID string,
) (*types.Knowledge, error)
// CreateKnowledgeFromPassage creates knowledge from text passages.
CreateKnowledgeFromPassage(ctx context.Context, kbID string, passage []string) (*types.Knowledge, error)
+1
View File
@@ -142,6 +142,7 @@ type ManualKnowledgePayload struct {
Title string `json:"title"`
Content string `json:"content"`
Status string `json:"status"`
TagID string `json:"tag_id"`
}
// NewManualKnowledgeMetadata creates a new ManualKnowledgeMetadata instance.