From 86a47f9e867fb259c4a4cfa68e32cf3013df1681 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Wed, 28 Jan 2026 14:30:53 +0800 Subject: [PATCH] fix(llm): add community-registry api (#24131) --- cmd/climc/shell/llm/instantmodel.go | 1 + pkg/llm/models/instantmodel.go | 4 ++++ pkg/mcclient/options/llm/instantmodel.go | 11 +++++++++++ 3 files changed, 16 insertions(+) diff --git a/cmd/climc/shell/llm/instantmodel.go b/cmd/climc/shell/llm/instantmodel.go index ecdde8f464..7a5fecec38 100644 --- a/cmd/climc/shell/llm/instantmodel.go +++ b/cmd/climc/shell/llm/instantmodel.go @@ -22,4 +22,5 @@ func init() { cmd.Perform("public", new(commonoptions.BasePublicOptions)) cmd.Perform("private", new(commonoptions.BaseIdOptions)) cmd.PerformClass("import", new(options.LLMInstantModelImportOptions)) + cmd.GetProperty(new(options.LLMInstantModelCommunityRegistryOptions)) } diff --git a/pkg/llm/models/instantmodel.go b/pkg/llm/models/instantmodel.go index 6ded75c559..6758b9f3c3 100644 --- a/pkg/llm/models/instantmodel.go +++ b/pkg/llm/models/instantmodel.go @@ -962,3 +962,7 @@ func (model *SInstantModel) CleanupImportTmpDir(ctx context.Context, userCred mc func (man *SInstantModelManager) GetOllamaRegistryYAML() string { return apis.OLLAMA_REGISTRY_YAML } + +func (man *SInstantModelManager) GetPropertyCommunityRegistry(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error) { + return jsonutils.Marshal(apis.OllamaRegistry), nil +} diff --git a/pkg/mcclient/options/llm/instantmodel.go b/pkg/mcclient/options/llm/instantmodel.go index 4df6728f2f..6e78e619b7 100644 --- a/pkg/mcclient/options/llm/instantmodel.go +++ b/pkg/mcclient/options/llm/instantmodel.go @@ -76,3 +76,14 @@ func (o *LLMInstantModelImportOptions) Params() (jsonutils.JSONObject, error) { } return jsonutils.Marshal(input), nil } + +type LLMInstantModelCommunityRegistryOptions struct { +} + +func (o *LLMInstantModelCommunityRegistryOptions) Params() (jsonutils.JSONObject, error) { + return nil, nil +} + +func (o *LLMInstantModelCommunityRegistryOptions) Property() string { + return "community-registry" +}