Use @ as the separator between model and provider

Also put the provider after the model (e.g. `gpt-4o@openai`,
`openai/gpt-4o@openrouter`. The aim here was to reduce clashing and
confusion with existing model naming conventions.
This commit is contained in:
Matt Low 2024-06-20 23:37:11 +00:00
parent dfe43179c0
commit 85a2abbbf3
1 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ func (c *Context) GetModels() (models []string) {
for _, p := range c.Config.Providers { for _, p := range c.Config.Providers {
for _, m := range *p.Models { for _, m := range *p.Models {
modelCounts[m]++ modelCounts[m]++
models = append(models, *p.Name+"/"+m) models = append(models, fmt.Sprintf("%s@%s", m, *p.Name))
} }
} }
@ -80,12 +80,12 @@ func (c *Context) GetModels() (models []string) {
} }
func (c *Context) GetModelProvider(model string) (string, api.ChatCompletionClient, error) { func (c *Context) GetModelProvider(model string) (string, api.ChatCompletionClient, error) {
parts := strings.Split(model, "/") parts := strings.Split(model, "@")
var provider string var provider string
if len(parts) > 1 { if len(parts) > 1 {
provider = parts[0] model = parts[0]
model = parts[1] provider = parts[1]
} }
for _, p := range c.Config.Providers { for _, p := range c.Config.Providers {