3e23aed69c
- 清理 .git-credentials/config 移除其他 Gitea/Gitee 凭证 - 删除 workspace-finances, workspace-fitness, workspace-resume, workspace-storage, workspace-travel 等工作区 - 删除 agents/finances, agents/fitness, agents/resume, agents/storage, agents/travel 等 agent 配置 - 删除 openclaw-weixin 微信相关配置 - 删除 plugin-skills 插件 - 更新 workspace-planner/MEMORY.md 记录 wit 项目目录 - 更新 workspace-backend/TOOLS.md - 更新 completions 自动补全脚本
71 lines
2.4 KiB
Python
71 lines
2.4 KiB
Python
#!/usr/bin/env python3
|
|
import json
|
|
|
|
PATH = "/root/.openclaw/openclaw.json"
|
|
with open(PATH, "r", encoding="utf-8") as f:
|
|
cfg = json.load(f)
|
|
|
|
# 1. Providers: keep only new-api
|
|
providers = cfg.get("models", {}).get("providers", {})
|
|
keep_prov = ["new-api"]
|
|
for k in list(providers.keys()):
|
|
if k not in keep_prov:
|
|
del providers[k]
|
|
print("providers now:", list(providers.keys()))
|
|
|
|
# 2. Agents: keep only backend/frontend/planner
|
|
keep_agents = ["backend", "frontend", "planner"]
|
|
alist = cfg.get("agents", {}).get("list", [])
|
|
new_list = [a for a in alist if a.get("id") in keep_agents]
|
|
removed = [a.get("id") for a in alist if a.get("id") not in keep_agents]
|
|
cfg["agents"]["list"] = new_list
|
|
print("removed agents:", removed)
|
|
print("kept agents:", [a.get("id") for a in new_list])
|
|
|
|
# 3. agents.defaults.model -> new-api/deepseek-v4-flash
|
|
defaults = cfg.get("agents", {}).get("defaults", {})
|
|
if "model" in defaults:
|
|
defaults["model"] = {"primary": "new-api/deepseek-v4-flash"}
|
|
print("defaults.model ->", defaults["model"])
|
|
|
|
# 4. agents.defaults.models: remove aliases referencing deleted providers
|
|
dm = defaults.get("models", {})
|
|
for k in list(dm.keys()):
|
|
if k.startswith("ollama/") or k.startswith("deepseek/"):
|
|
del dm[k]
|
|
print("remaining model aliases:", list(dm.keys()))
|
|
|
|
# 5. memorySearch: uses openai provider (deleted) -> disable
|
|
if "memorySearch" in defaults:
|
|
del defaults["memorySearch"]
|
|
print("removed memorySearch")
|
|
|
|
# 6. subagents allowAgents: only the 3 kept agents
|
|
sub = defaults.get("subagents", {})
|
|
if "allowAgents" in sub:
|
|
sub["allowAgents"] = keep_agents
|
|
print("subagents.allowAgents ->", keep_agents)
|
|
|
|
# 7. plugins.allow: remove deepseek & ollama plugins
|
|
plugs = cfg.get("plugins", {})
|
|
allow = plugs.get("allow", [])
|
|
new_allow = [p for p in allow if p not in ("deepseek", "ollama")]
|
|
plugs["allow"] = new_allow
|
|
print("plugins.allow now:", new_allow)
|
|
entries = plugs.get("entries", {})
|
|
for e in ("deepseek", "ollama"):
|
|
if e in entries:
|
|
del entries[e]
|
|
print("plugins.entries now:", list(entries.keys()))
|
|
|
|
# 8. auth.profiles: remove ollama profile
|
|
auth = cfg.get("auth", {})
|
|
profiles = auth.get("profiles", {})
|
|
if "ollama:default" in profiles:
|
|
del profiles["ollama:default"]
|
|
print("auth.profiles now:", list(profiles.keys()))
|
|
|
|
with open(PATH, "w", encoding="utf-8") as f:
|
|
json.dump(cfg, f, ensure_ascii=False, indent=2)
|
|
print("DONE write")
|