fix: read config upstream type default value

This commit is contained in:
2024-01-23 15:52:46 +08:00
parent 33f341026f
commit 49169452fe

View File

@@ -62,11 +62,11 @@ func readConfig(filepath string) Config {
log.Fatalf("Can't parse upstream endpoint URL '%s': %s", upstream.Endpoint, err) log.Fatalf("Can't parse upstream endpoint URL '%s': %s", upstream.Endpoint, err)
} }
config.Upstreams[i].URL = endpoint config.Upstreams[i].URL = endpoint
if upstream.Type == "" { if config.Upstreams[i].Type == "" {
upstream.Type = "openai" config.Upstreams[i].Type = "openai"
} }
if (upstream.Type != "openai") && (upstream.Type != "replicate") { if (config.Upstreams[i].Type != "openai") && (config.Upstreams[i].Type != "replicate") {
log.Fatalf("Unsupported upstream type '%s'", upstream.Type) log.Fatalf("Unsupported upstream type '%s'", config.Upstreams[i].Type)
} }
} }