mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-18 20:27:57 +00:00
chore(api): return values from schema (#4153)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
parent
a73c660fee
commit
1770b92fb6
@ -21,10 +21,15 @@ func SystemInformations(ml *model.ModelLoader, appConfig *config.ApplicationConf
|
||||
for b := range appConfig.ExternalGRPCBackends {
|
||||
availableBackends = append(availableBackends, b)
|
||||
}
|
||||
|
||||
sysmodels := []schema.SysInfoModel{}
|
||||
for _, m := range loadedModels {
|
||||
sysmodels = append(sysmodels, schema.SysInfoModel{ID: m.ID})
|
||||
}
|
||||
return c.JSON(
|
||||
schema.SystemInformationResponse{
|
||||
Backends: availableBackends,
|
||||
Models: loadedModels,
|
||||
Models: sysmodels,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package schema
|
||||
|
||||
import (
|
||||
"github.com/mudler/LocalAI/core/p2p"
|
||||
"github.com/mudler/LocalAI/pkg/model"
|
||||
gopsutil "github.com/shirou/gopsutil/v3/process"
|
||||
)
|
||||
|
||||
@ -77,7 +76,11 @@ type P2PNodesResponse struct {
|
||||
FederatedNodes []p2p.NodeData `json:"federated_nodes" yaml:"federated_nodes"`
|
||||
}
|
||||
|
||||
type SystemInformationResponse struct {
|
||||
Backends []string `json:"backends"`
|
||||
Models []model.Model `json:"loaded_models"`
|
||||
type SysInfoModel struct {
|
||||
ID string `json:"id"`
|
||||
}
|
||||
|
||||
type SystemInformationResponse struct {
|
||||
Backends []string `json:"backends"`
|
||||
Models []SysInfoModel `json:"loaded_models"`
|
||||
}
|
||||
|
@ -103,13 +103,13 @@ FILE:
|
||||
return models, nil
|
||||
}
|
||||
|
||||
func (ml *ModelLoader) ListModels() []Model {
|
||||
func (ml *ModelLoader) ListModels() []*Model {
|
||||
ml.mu.Lock()
|
||||
defer ml.mu.Unlock()
|
||||
|
||||
models := []Model{}
|
||||
models := []*Model{}
|
||||
for _, model := range ml.models {
|
||||
models = append(models, *model)
|
||||
models = append(models, model)
|
||||
}
|
||||
|
||||
return models
|
||||
|
Loading…
Reference in New Issue
Block a user