feat: Implement configuration management commands for AI providers, gateway tokens, and environment variables.

This commit is contained in:
MrFadiAi
2026-02-19 15:20:45 +01:00
parent 28e549b12d
commit 327d00683a
2 changed files with 14 additions and 4 deletions
+3 -3
View File
@@ -5,8 +5,8 @@
"apiKey": "3e911333b0dc462dba0b4ce886303cce.4WF3QN7zfirCWXxS",
"models": [
{
"id": "glm-4",
"name": "GLM-4",
"id": "glm-5",
"name": "GLM-5",
"api": "openai-completions",
"reasoning": false,
"input": [
@@ -43,4 +43,4 @@
]
}
}
}
}
+11 -1
View File
@@ -1855,14 +1855,24 @@ pub async fn save_telegram_account(account: TelegramAccount) -> Result<String, S
if let Some(top_token) = config["channels"]["telegram"].get("botToken").and_then(|v| v.as_str()).map(|s| s.to_string()) {
if !top_token.is_empty() {
// Move existing single-bot config to accounts["default"]
let existing = json!({
let mut existing = json!({
"botToken": top_token,
"groupPolicy": config["channels"]["telegram"].get("groupPolicy").cloned().unwrap_or(json!(null)),
"dmPolicy": config["channels"]["telegram"].get("dmPolicy").cloned().unwrap_or(json!(null)),
"streamMode": config["channels"]["telegram"].get("streamMode").cloned().unwrap_or(json!(null)),
"groups": config["channels"]["telegram"].get("groups").cloned().unwrap_or(json!(null)),
});
// Migrate allowList
if let Some(allow_from) = config["channels"]["telegram"].get("allowFrom").cloned() {
existing["allowFrom"] = allow_from;
}
if let Some(group_allow_from) = config["channels"]["telegram"].get("groupAllowFrom").cloned() {
existing["groupAllowFrom"] = group_allow_from;
}
config["channels"]["telegram"]["accounts"]["default"] = existing;
// Remove top-level single-bot fields
if let Some(tg) = config["channels"]["telegram"].as_object_mut() {
tg.remove("botToken");