Changeset 0.9.4 (#54)

This commit is contained in:
2026-02-24 10:44:12 +00:00
parent 90021157e6
commit 5e416d3726
26 changed files with 1333 additions and 108 deletions

View File

@@ -119,7 +119,9 @@ type ProviderConfig struct {
Name string `json:"name" db:"name"`
Provider string `json:"provider" db:"provider"`
Endpoint string `json:"endpoint" db:"endpoint"`
APIKeyEnc string `json:"-" db:"api_key_enc"`
APIKeyEnc []byte `json:"-" db:"api_key_enc"`
KeyNonce []byte `json:"-" db:"key_nonce"`
KeyScope string `json:"-" db:"key_scope"`
ModelDefault string `json:"model_default,omitempty" db:"model_default"`
Config JSONMap `json:"config,omitempty" db:"config"`
Headers JSONMap `json:"headers,omitempty" db:"headers"`
@@ -128,10 +130,16 @@ type ProviderConfig struct {
IsPrivate bool `json:"is_private" db:"is_private"`
}
// HasKey returns true if an encrypted API key is stored.
func (p *ProviderConfig) HasKey() bool {
return len(p.APIKeyEnc) > 0
}
type ProviderConfigPatch struct {
Name *string `json:"name,omitempty"`
Endpoint *string `json:"endpoint,omitempty"`
APIKeyEnc *string `json:"-"`
APIKeyEnc []byte `json:"-"`
KeyNonce []byte `json:"-"`
ModelDefault *string `json:"model_default,omitempty"`
Config JSONMap `json:"config,omitempty"`
Headers JSONMap `json:"headers,omitempty"`