diff --git a/config.go b/config.go index 29aedba1..d9804a62 100644 --- a/config.go +++ b/config.go @@ -88,6 +88,7 @@ type API struct { Version string `yaml:"version"` BaseURL string `yaml:"base-url"` Models map[string]Model `yaml:"models"` + User string `yaml:"user"` } // APIs is a type alias to allow custom YAML decoding. @@ -175,6 +176,7 @@ type Config struct { ListRoles bool Delete string DeleteOlderThan time.Duration + User string cacheReadFromID, cacheWriteToID, cacheWriteToTitle string } diff --git a/mods.go b/mods.go index 8b6fedb2..64ef3edb 100644 --- a/mods.go +++ b/mods.go @@ -351,6 +351,9 @@ func (m *Mods) startCompletionCmd(content string) tea.Cmd { if mod.API == "azure-ad" { ccfg.APIType = openai.APITypeAzureAD } + if api.User != "" { + cfg.User = api.User + } default: key, err := m.ensureKey(api, "OPENAI_API_KEY", "https://platform.openai.com/account/api-keys") if err != nil { diff --git a/stream.go b/stream.go index 12ea229b..de713e97 100644 --- a/stream.go +++ b/stream.go @@ -25,6 +25,7 @@ func (m *Mods) createOpenAIStream(content string, ccfg openai.ClientConfig, mod Model: mod.Name, Messages: m.messages, Stream: true, + User: cfg.User, } if mod.API != "perplexity" || !strings.Contains(mod.Name, "online") {