mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-04 10:13:53 +08:00
fix: fix null pointer in unconfigured provider fetch, add model name to list
This commit is contained in:
@@ -83,6 +83,7 @@ type BackupProvider struct {
|
||||
|
||||
type LLMItem struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Logo string `json:"logo"`
|
||||
Config string `json:"config"`
|
||||
AccessConfiguration string `json:"access_configuration"`
|
||||
|
||||
+6
-1
@@ -411,12 +411,16 @@ func (i *imlProviderModule) UnConfiguredProviders(ctx context.Context) ([]*ai_dt
|
||||
// 已配置,跳过
|
||||
continue
|
||||
}
|
||||
defaultLLMID := ""
|
||||
defaultLLM, _ := v.DefaultModel(model_runtime.ModelTypeLLM)
|
||||
if defaultLLM != nil {
|
||||
defaultLLMID = defaultLLM.ID()
|
||||
}
|
||||
item := &ai_dto.ProviderItem{
|
||||
Id: v.ID(),
|
||||
Name: v.Name(),
|
||||
Logo: v.Logo(),
|
||||
DefaultLLM: defaultLLM.ID(),
|
||||
DefaultLLM: defaultLLMID,
|
||||
Sort: v.Sort(),
|
||||
}
|
||||
items = append(items, item)
|
||||
@@ -508,6 +512,7 @@ func (i *imlProviderModule) LLMs(ctx context.Context, driver string) ([]*ai_dto.
|
||||
for _, v := range llms {
|
||||
items = append(items, &ai_dto.LLMItem{
|
||||
Id: v.ID(),
|
||||
Name: v.Name(),
|
||||
Logo: v.Logo(),
|
||||
Config: v.DefaultConfig(),
|
||||
AccessConfiguration: v.AccessConfiguration(),
|
||||
|
||||
Reference in New Issue
Block a user