feat(llm): support OpenClaw manual config mode (#24719)

When ManualConfig is enabled, inject OPENCLAW_MANUAL_CONFIG=1 env var
and skip provider/channel credential injection, allowing users to
configure providers and channels themselves inside the desktop.
This commit is contained in:
Zexi Li
2026-04-24 11:45:46 +08:00
committed by GitHub
parent 67cceae9e2
commit 9be35e4b45
3 changed files with 15 additions and 5 deletions
+1
View File
@@ -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"`
+1
View File
@@ -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
+13 -5
View File
@@ -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 {