mirror of
https://github.com/coalaura/whiskr.git
synced 2025-09-09 01:09:54 +00:00
clean model names
This commit is contained in:
13
models.go
13
models.go
@@ -1,6 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "context"
|
import (
|
||||||
|
"context"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
type Model struct {
|
type Model struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
@@ -22,9 +25,15 @@ func LoadModels() ([]*Model, error) {
|
|||||||
models := make([]*Model, len(list))
|
models := make([]*Model, len(list))
|
||||||
|
|
||||||
for index, model := range list {
|
for index, model := range list {
|
||||||
|
name := model.Name
|
||||||
|
|
||||||
|
if index := strings.Index(name, ": "); index != -1 {
|
||||||
|
name = name[index+2:]
|
||||||
|
}
|
||||||
|
|
||||||
m := &Model{
|
m := &Model{
|
||||||
ID: model.ID,
|
ID: model.ID,
|
||||||
Name: model.Name,
|
Name: name,
|
||||||
Description: model.Description,
|
Description: model.Description,
|
||||||
SupportedParameters: model.SupportedParameters,
|
SupportedParameters: model.SupportedParameters,
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user