Documentation
¶
Overview ¶
Package aiconfig manages shared and user-scoped AI provider configuration.
Index ¶
- func ErrInvalid() error
- type GlobalStatus
- type Input
- type Service
- func (s *Service) Create(ctx context.Context, ownerID string, in Input) (models.AIProviderSummary, error)
- func (s *Service) Delete(ctx context.Context, ownerID, id string) error
- func (s *Service) Global() GlobalStatus
- func (s *Service) List(ctx context.Context, ownerID string) ([]models.AIProviderSummary, error)
- func (s *Service) Models(ctx context.Context, ownerID, id string) ([]string, error)
- func (s *Service) ModelsForInput(ctx context.Context, in Input) ([]string, error)
- func (s *Service) ProviderModel(ctx context.Context, ownerID, id string) (string, error)
- func (s *Service) Resolve(ctx context.Context, ownerID, id string) (models.AIProviderConfig, string, error)
- func (s *Service) Test(ctx context.Context, ownerID, id string) error
- func (s *Service) TestInput(ctx context.Context, in Input) error
- func (s *Service) Update(ctx context.Context, ownerID, id string, in Input) (models.AIProviderSummary, error)
- func (s *Service) WithModels(r *modelreg.Registry) *Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GlobalStatus ¶
type GlobalStatus struct {
Configured bool `json:"configured"`
Provider string `json:"provider,omitempty"`
Kind string `json:"kind,omitempty"`
Model string `json:"model,omitempty"`
}
GlobalStatus is the read-only shared AI config projection.
type Input ¶
type Input struct {
Kind models.AIProviderKind
Name string
BaseURL string
APIKey string
Models []string
Model string
}
Input is a create/update request for a user provider.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the user-provider CRUD + global-status surface.
func New ¶
func New(s store.AIProviderStore, vault secrets.SecretStore, global config.AIConfig) *Service
New wires the provider store, the secret vault, and the global config.
func (*Service) Create ¶
func (s *Service) Create(ctx context.Context, ownerID string, in Input) (models.AIProviderSummary, error)
Create validates input, encrypts the key, and persists a new owned provider.
func (*Service) Global ¶
func (s *Service) Global() GlobalStatus
Global returns the read-only shared-AI status (never the key).
func (*Service) ModelsForInput ¶
ModelsForInput lists models for an unsaved provider draft.
func (*Service) ProviderModel ¶
ProviderModel returns the configured model for an owned provider without decrypting its API key.
func (*Service) Resolve ¶
func (s *Service) Resolve(ctx context.Context, ownerID, id string) (models.AIProviderConfig, string, error)
Resolve returns an owned provider with its decrypted API key for use at chat time. The plaintext key never leaves the AI service.
func (*Service) TestInput ¶
TestInput verifies an unsaved provider draft without persisting the API key.