feat(creator_name): add creator_name field to agents and knowledge bases for enhanced visibility
Introduced a new optional field, creator_name, in both CustomAgent and KnowledgeBase types to allow the front end to display the creator's name. This enhancement enables better differentiation between resources created by the current user and those created by other members of the same tenant. Updated relevant API handlers to populate this field during list operations, ensuring accurate representation in the UI. Additionally, modified the ResourceOriginBadge component to utilize the creator_name for improved context in resource listings. Refs: #1303
This commit is contained in:
@@ -102,6 +102,11 @@ type CustomAgent struct {
|
||||
CreatedAt time.Time `yaml:"created_at" json:"created_at"`
|
||||
UpdatedAt time.Time `yaml:"updated_at" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `yaml:"deleted_at" json:"deleted_at" gorm:"index"`
|
||||
|
||||
// CreatorName 由 list handler 在返回前批量回填,作用同 KnowledgeBase.CreatorName:
|
||||
// 让前端列表卡片区分「我创建」与「同租户其他成员创建」。不落库,内建 agent / 老数据
|
||||
// 仍可能为空。
|
||||
CreatorName string `yaml:"-" json:"creator_name,omitempty" gorm:"-"`
|
||||
}
|
||||
|
||||
// CustomAgentConfig represents the configuration of a custom agent
|
||||
|
||||
@@ -111,6 +111,10 @@ type KnowledgeBase struct {
|
||||
ProcessingCount int64 `yaml:"processing_count" json:"processing_count" gorm:"-"`
|
||||
// ShareCount indicates the number of organizations this knowledge base is shared with (not stored in database)
|
||||
ShareCount int64 `yaml:"share_count" json:"share_count" gorm:"-"`
|
||||
// CreatorName 是 CreatorID 对应用户的展示名(username / email 等),
|
||||
// 仅在列表场景由 handler 批量回填,不落库;为空表示创建者无法解析(用户已删除、
|
||||
// CreatorID 为空的老数据等)。前端用它在卡片来源徽章上做 mine vs tenant 的二分。
|
||||
CreatorName string `yaml:"-" json:"creator_name,omitempty" gorm:"-"`
|
||||
}
|
||||
|
||||
// KnowledgeBaseConfig represents the knowledge base configuration
|
||||
|
||||
Reference in New Issue
Block a user