mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 17:33:56 +08:00
⛄ Sync 2026-03-31 20:32:14
This commit is contained in:
1 parent
5e01d5e315
commit
0bbae3ff9d
18 files changed
+428
-1004
No files matched your search
@@ -639,6 +639,23 @@ local function ensure_table(parent, key)
|
||||
return parent[key]
|
||||
end
|
||||
|
||||
local function prune_empty_tables(node)
|
||||
if type(node) ~= "table" then
|
||||
return false
|
||||
end
|
||||
|
||||
for k, v in pairs(node) do
|
||||
if type(v) == "table" then
|
||||
prune_empty_tables(v)
|
||||
if next(v) == nil then
|
||||
node[k] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return next(node) == nil
|
||||
end
|
||||
|
||||
local function read_config(path)
|
||||
local raw = slurp(path)
|
||||
if not raw or raw == "" then
|
||||
@@ -769,6 +786,8 @@ local defaults = ensure_table(agents, "defaults")
|
||||
local model = ensure_table(defaults, "model")
|
||||
model.primary = os.getenv("DEFAULT_AGENT_MODEL") or "anthropic/claude-sonnet-4-6"
|
||||
|
||||
prune_empty_tables(cfg)
|
||||
|
||||
local encoded = json.stringify(cfg, true)
|
||||
if encoded then
|
||||
encoded = encoded:gsub("\\/", "/")
|
||||
|
||||
Reference in new issue
Block a user