Nik Afiq ad50d641bd
All checks were successful
CI / test (push) Successful in 5s
CI / build-ai-gateway (push) Successful in 43s
CI / build-ha-gateway (push) Successful in 47s
CI / build-discord-bot (push) Successful in 41s
feat: enhance AI model management in Discord bot
- Updated LLMClient interface to support model-specific generation and model listing.
- Integrated model store and validator into the command application for managing AI models.
- Implemented commands for setting, getting, and listing active AI models in Discord.
- Enhanced AI query handling to utilize the selected model and return model information in responses.
- Added caching mechanism for model validation to improve performance.
- Introduced gRPC methods for listing available AI models in the ai-gateway.
- Updated protobuf definitions to include model-related fields and messages.
- Added tests for model store and validator functionalities.
2026-04-21 22:52:00 +09:00

29 lines
547 B
Go

package modelstore
import "sync"
// Store keeps the globally selected AI model in memory.
type Store struct {
mu sync.RWMutex
selected string
}
// New constructs an empty in-memory model store.
func New() *Store {
return &Store{}
}
// Get returns the currently selected model, or empty for default behavior.
func (s *Store) Get() string {
s.mu.RLock()
defer s.mu.RUnlock()
return s.selected
}
// Set updates the currently selected model.
func (s *Store) Set(model string) {
s.mu.Lock()
defer s.mu.Unlock()
s.selected = model
}