feat: refactor candidate loader to encapsulate skill definition retrieval and loading logic

This commit is contained in:
mlogclub
2026-04-13 19:45:52 +08:00
parent 1f0406ec91
commit 4b7c345d75
2 changed files with 11 additions and 4 deletions
+8 -2
View File
@@ -9,11 +9,17 @@ import (
"github.com/mlogclub/simple/sqls"
)
func findManualSkillDefinition(skillCode string) *models.SkillDefinition {
func newCandidateLoader() *candidateLoader {
return &candidateLoader{}
}
type candidateLoader struct{}
func (l *candidateLoader) findManualSkillDefinition(skillCode string) *models.SkillDefinition {
return repositories.SkillDefinitionRepository.GetByCode(sqls.DB(), skillCode)
}
func loadCandidateSkills(aiAgent *models.AIAgent) []models.SkillDefinition {
func (l *candidateLoader) loadCandidateSkills(aiAgent *models.AIAgent) []models.SkillDefinition {
if aiAgent == nil {
return nil
}