feat: add skill management service

This commit is contained in:
2026-05-13 16:40:29 +08:00
parent 3636952dca
commit 12a6a83840
4 changed files with 948 additions and 10 deletions

View File

@@ -0,0 +1,32 @@
package service
import (
"context"
"time"
)
func (s *Service) StartAutoUpdate(ctx context.Context) {
go func() {
cfg, err := s.LoadConfig()
if err != nil {
return
}
if cfg.Update.CheckOnStartup {
_ = s.RunAutoUpdate(ctx)
}
interval := cfg.Update.IntervalMinutes
if interval <= 0 {
interval = 60
}
ticker := time.NewTicker(time.Duration(interval) * time.Minute)
defer ticker.Stop()
for {
select {
case <-ctx.Done():
return
case <-ticker.C:
_ = s.RunAutoUpdate(ctx)
}
}
}()
}