Files
TrueGrowth/vendor/aigcpanel/cli/cmd/model_list.go
Jammy 52636c91ae
Some checks failed
CI / main (push) Has been cancelled
CI / release-e2e (push) Has been cancelled
Track bundled vendor runtime sources
2026-07-07 10:05:50 +08:00

32 lines
679 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package cmd
import (
"aigcpanel-cli/internal"
"github.com/spf13/cobra"
)
var modelListCmd = &cobra.Command{
Use: "model_list",
Short: "List installed AI models",
RunE: func(cmd *cobra.Command, args []string) error {
cfg, err := internal.LoadAuthConfig()
if err != nil {
return err
}
result, err := internal.DoRequest(cfg, "/api/model/list", map[string]any{})
if err != nil {
return err
}
// 只保留 name/title/version/functions去掉 id
if data, ok := result["data"].([]any); ok {
for _, item := range data {
if model, ok := item.(map[string]any); ok {
delete(model, "id")
}
}
}
return internal.PrintJSON(result)
},
}