add proxy.Process to manage upstream proxy logic

This commit is contained in:
Benson Wong
2024-11-17 16:41:15 -08:00
parent a8e5ee13b9
commit 36a31f450f
4 changed files with 249 additions and 202 deletions

View File

@@ -25,22 +25,22 @@ type Config struct {
HealthCheckTimeout int `yaml:"healthCheckTimeout"`
}
func (c *Config) FindConfig(modelName string) (ModelConfig, bool) {
func (c *Config) FindConfig(modelName string) (ModelConfig, string, bool) {
modelConfig, found := c.Models[modelName]
if found {
return modelConfig, true
return modelConfig, modelName, true
}
// Search through aliases to find the right config
for _, config := range c.Models {
for actual, config := range c.Models {
for _, alias := range config.Aliases {
if alias == modelName {
return config, true
return config, actual, true
}
}
}
return ModelConfig{}, false
return ModelConfig{}, "", false
}
func LoadConfig(path string) (*Config, error) {