This commit is contained in:
user123
2026-01-29 00:04:09 +08:00
parent a66cc84a48
commit 9f2fa10002
3 changed files with 95 additions and 56 deletions

View File

@@ -461,23 +461,30 @@ func GenerateAndWriteConfig(opts ConfigOptions) error {
},
Tools: ToolsConfig{
Elevated: ElevatedConfig{
Enabled: true,
AllowFrom: map[string][]string{
"telegram": {opts.AdminID},
},
Enabled: true,
AllowFrom: map[string][]string{},
},
Allow: []string{"exec", "process", "read", "write", "edit", "web_search", "web_fetch", "cron"},
},
Channels: ChannelsConfig{
Telegram: TelegramConfig{
Enabled: true,
BotToken: opts.BotToken,
Enabled: false,
DMPolicy: "pairing",
AllowFrom: []string{opts.AdminID},
AllowFrom: []string{},
},
},
}
// Configure Telegram if token provided
if opts.BotToken != "" {
config.Channels.Telegram.Enabled = true
config.Channels.Telegram.BotToken = opts.BotToken
if opts.AdminID != "" {
config.Channels.Telegram.AllowFrom = []string{opts.AdminID}
config.Tools.Elevated.AllowFrom["telegram"] = []string{opts.AdminID}
}
}
if opts.ApiType == "anthropic" {
config.Env = map[string]string{
"ANTHROPIC_API_KEY": opts.AnthropicKey,
@@ -489,6 +496,16 @@ func GenerateAndWriteConfig(opts ConfigOptions) error {
},
},
}
} else if opts.ApiType == "skip" {
// Minimal config for Web UI setup
config.Channels.Telegram.Enabled = false
config.Agents = AgentsConfig{
Defaults: AgentDefaults{
Model: ModelRef{
Primary: "anthropic/claude-opus-4-5", // Default placeholder
},
},
}
} else {
// OpenAI Compatible
config.Agents = AgentsConfig{