diff --git a/pkg/apis/llm/llm_spec.go b/pkg/apis/llm/llm_spec.go index 9ac3cfbb94..1268690dfc 100644 --- a/pkg/apis/llm/llm_spec.go +++ b/pkg/apis/llm/llm_spec.go @@ -137,6 +137,7 @@ type LLMSpecOpenClawChannel struct { } type LLMSpecOpenClaw struct { + ManualConfig bool `json:"manual_config"` Providers []*LLMSpecOpenClawProvider `json:"providers"` Channels []*LLMSpecOpenClawChannel `json:"channels"` WorkspaceTemplates *LLMSpecOpenClawWorkspaceTemplates `json:"workspace_templates"` diff --git a/pkg/apis/llm/openclaw.go b/pkg/apis/llm/openclaw.go index 2c72eb547c..892e344897 100644 --- a/pkg/apis/llm/openclaw.go +++ b/pkg/apis/llm/openclaw.go @@ -3,6 +3,7 @@ package llm const ( LLM_OPENCLAW_GATEWAY_TOKEN = LLMEnvKey("OPENCLAW_GATEWAY_TOKEN") LLM_OPENCLAW_CUSTOM_CONFIG = LLMEnvKey("OPENCLAW_CUSTOM_CONFIG") + LLM_OPENCLAW_MANUAL_CONFIG = LLMEnvKey("OPENCLAW_MANUAL_CONFIG") LLM_OPENCLAW_CUSTOM_CONFIG_FILE = "/opt/openclaw_base_config.json" // templates diff --git a/pkg/llm/drivers/llm_container/openclaw.go b/pkg/llm/drivers/llm_container/openclaw.go index 5366fb93e4..c406bfe5ea 100644 --- a/pkg/llm/drivers/llm_container/openclaw.go +++ b/pkg/llm/drivers/llm_container/openclaw.go @@ -97,6 +97,7 @@ func mergeOpenClaw(llm, sku *api.LLMSpecOpenClaw) *api.LLMSpecOpenClaw { return copyOpenClaw(llm) } out := &api.LLMSpecOpenClaw{} + out.ManualConfig = llm.ManualConfig || sku.ManualConfig if len(llm.Providers) > 0 { out.Providers = make([]*api.LLMSpecOpenClawProvider, len(llm.Providers)) copy(out.Providers, llm.Providers) @@ -132,6 +133,7 @@ func copyOpenClaw(s *api.LLMSpecOpenClaw) *api.LLMSpecOpenClaw { return nil } out := &api.LLMSpecOpenClaw{} + out.ManualConfig = s.ManualConfig if len(s.Providers) > 0 { out.Providers = make([]*api.LLMSpecOpenClawProvider, len(s.Providers)) copy(out.Providers, s.Providers) @@ -335,11 +337,17 @@ func (c *openclaw) GetContainerSpecs(ctx context.Context, llm *models.SLLM, imag } } spec := llm.LLMSpec.OpenClaw - for _, provider := range spec.Providers { - openclawSpec.Envs = appendCredentialEnvs(openclawSpec.Envs, provider.Credential) - } - for _, channel := range spec.Channels { - openclawSpec.Envs = appendCredentialEnvs(openclawSpec.Envs, channel.Credential) + if spec.ManualConfig { + openclawSpec.Envs = append(openclawSpec.Envs, + &commonapi.ContainerKeyValue{Key: string(api.LLM_OPENCLAW_MANUAL_CONFIG), Value: "1"}, + ) + } else { + for _, provider := range spec.Providers { + openclawSpec.Envs = appendCredentialEnvs(openclawSpec.Envs, provider.Credential) + } + for _, channel := range spec.Channels { + openclawSpec.Envs = appendCredentialEnvs(openclawSpec.Envs, channel.Credential) + } } if sku.LLMSpec != nil && sku.LLMSpec.OpenClaw != nil {