feat(auto): quota-aware AUTO slot scheduling (model tiers, hour/week/month resets) + key scope periods; fix key/slot create/delete UX

This commit is contained in:
root
2026-08-09 11:07:38 +08:00
parent 3408c9cb1f
commit 859d310ad3
9 changed files with 1065 additions and 162 deletions

View File

@ -137,4 +137,21 @@ func (s *Store) DeleteKey(key string) (bool, error) {
}
s.data.Keys = kept
return true, s.persistLocked()
}
// AutoRules returns the persisted AUTO scheduling slots.
func (s *Store) AutoRules() []ModelScope {
s.mu.Lock()
defer s.mu.Unlock()
out := make([]ModelScope, len(s.data.Auto))
copy(out, s.data.Auto)
return out
}
// SaveAutoRules persists the AUTO scheduling slots.
func (s *Store) SaveAutoRules(entries []ModelScope) error {
s.mu.Lock()
defer s.mu.Unlock()
s.data.Auto = entries
return s.persistLocked()
}