101577f163
- Updated import paths in multiple service files to reflect the new agent-desk module. - Added a new configuration file for agent-desk in the Docker setup.
34 lines
920 B
Go
34 lines
920 B
Go
package skills
|
|
|
|
import (
|
|
"agent-desk/internal/models"
|
|
"agent-desk/internal/pkg/enums"
|
|
"agent-desk/internal/pkg/utils"
|
|
"agent-desk/internal/repositories"
|
|
|
|
"github.com/mlogclub/simple/sqls"
|
|
)
|
|
|
|
var newCandidateLoader = func() *candidateLoader {
|
|
return &candidateLoader{}
|
|
}
|
|
|
|
type candidateLoader struct {
|
|
}
|
|
|
|
func (l *candidateLoader) findManualSkillDefinition(skillCode string) *models.SkillDefinition {
|
|
return repositories.SkillDefinitionRepository.GetByCode(sqls.DB(), skillCode)
|
|
}
|
|
|
|
func (l *candidateLoader) loadCandidateSkills(aiAgent models.AIAgent) []models.SkillDefinition {
|
|
skillIDs := utils.SplitInt64s(aiAgent.SkillIDs)
|
|
skills := repositories.SkillDefinitionRepository.GetByIDs(sqls.DB(), skillIDs)
|
|
ret := make([]models.SkillDefinition, 0, len(skillIDs))
|
|
for _, id := range skillIDs {
|
|
if skill, ok := skills[id]; ok && skill.Status == enums.StatusOk {
|
|
ret = append(ret, skill)
|
|
}
|
|
}
|
|
return ret
|
|
}
|