feat(ECR-023): AICoreConfig KnowledgeSource 只读并 Closed

运营可观测知识源目录(knowledge_sources + admin /ai),不含 Chunk/Embedding。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-08 01:49:58 +08:00
co-authored by Cursor
parent dd4d644eaa
commit bf1ae8bc53
25 changed files with 555 additions and 3 deletions
@@ -11,6 +11,7 @@ import (
)
var ErrSystemPromptNotFound = errString("system prompt not found")
var ErrKnowledgeSourceNotFound = errString("knowledge source not found")
// ListSystemPrompts returns SystemPrompt catalog.
func (s *Service) ListSystemPrompts(ctx context.Context) ([]repository.SystemPromptRow, error) {
@@ -32,3 +33,24 @@ func (s *Service) GetSystemPrompt(ctx context.Context, id uuid.UUID) (*repositor
}
return row, err
}
// ListKnowledgeSources returns KnowledgeSource catalog.
func (s *Service) ListKnowledgeSources(ctx context.Context) ([]repository.KnowledgeSourceRow, error) {
items, err := s.Repo.ListKnowledgeSources(ctx)
if err != nil {
return nil, err
}
if items == nil {
items = []repository.KnowledgeSourceRow{}
}
return items, nil
}
// GetKnowledgeSource loads one source.
func (s *Service) GetKnowledgeSource(ctx context.Context, id uuid.UUID) (*repository.KnowledgeSourceRow, error) {
row, err := s.Repo.GetKnowledgeSource(ctx, id)
if errors.Is(err, pgx.ErrNoRows) {
return nil, ErrKnowledgeSourceNotFound
}
return row, err
}