mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-04 10:13:53 +08:00
fix bug
This commit is contained in:
@@ -268,7 +268,8 @@ func (i *imlBalanceModule) getLocalBalances(ctx context.Context, v string) ([]*g
|
||||
var has bool
|
||||
v, has = i.settingService.Get(ctx, "system.ai_model.ollama_address")
|
||||
if !has {
|
||||
return nil, fmt.Errorf("ollama address not found")
|
||||
//return nil, fmt.Errorf("ollama address not found")
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +295,8 @@ func (i *imlBalanceModule) getBalances(ctx context.Context) ([]*gateway.DynamicR
|
||||
}
|
||||
v, has := i.settingService.Get(ctx, "system.ai_model.ollama_address")
|
||||
if !has {
|
||||
return nil, fmt.Errorf("ollama address not found")
|
||||
//return nil, fmt.Errorf("ollama address not found")
|
||||
return nil, nil
|
||||
}
|
||||
releases := make([]*gateway.DynamicRelease, 0, len(balances))
|
||||
for _, item := range balances {
|
||||
@@ -305,6 +307,10 @@ func (i *imlBalanceModule) getBalances(ctx context.Context) ([]*gateway.DynamicR
|
||||
continue
|
||||
}
|
||||
base = fmt.Sprintf("%s://%s%s", p.URI().Scheme(), p.URI().Host(), p.URI().Path())
|
||||
} else {
|
||||
if v == "" {
|
||||
continue
|
||||
}
|
||||
}
|
||||
releases = append(releases, newRelease(item, base))
|
||||
}
|
||||
|
||||
@@ -614,7 +614,8 @@ func (i *imlLocalModel) getLocalModels(ctx context.Context, v string) ([]*gatewa
|
||||
var has bool
|
||||
v, has = i.settingService.Get(ctx, "system.ai_model.ollama_address")
|
||||
if !has {
|
||||
return nil, errors.New("ollama_address not set")
|
||||
//return nil, errors.New("ollama_address not set")
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
provider := ai_provider_local.ProviderLocal
|
||||
|
||||
@@ -473,7 +473,7 @@ func (i *imlServiceModule) Edit(ctx context.Context, id string, input *service_d
|
||||
|
||||
}
|
||||
}
|
||||
if input.ModelMapping != nil {
|
||||
if input.ModelMapping != nil && *input.ModelMapping != "" {
|
||||
m := make(map[string]string)
|
||||
err = json.Unmarshal([]byte(*input.ModelMapping), &m)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user