Skip to content

Commit ca9aa95

Browse files
new_model_mechanics
1 parent 2287081 commit ca9aa95

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

luasrc/actions/models/remove_model.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ private_vibescript.remove_model = function()
44
error("No model (--" .. private_vibescript.MODEL .. ") provided", 0)
55
end
66

7+
local models = get_prop("models", {})
78
local model_found = false
8-
for i = 1, #config_json.models do
9-
if config_json.models[i].name == model_name then
10-
table.remove(config_json.models, i)
9+
for i = 1, #models do
10+
if models[i].name == model_name then
11+
table.remove(models, i)
1112
model_found = true
1213
break
1314
end
@@ -17,5 +18,5 @@ private_vibescript.remove_model = function()
1718
error("Model (" .. model_name .. ") does not exist", 0)
1819
end
1920

20-
set_prop("models", config_json.models)
21+
set_prop("models", models)
2122
end
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
private_vibescript.set_model_as_default = function(config_json)
1+
private_vibescript.set_model_as_default = function()
22
local model_name = argv.get_flag_arg_by_index({ private_vibescript.MODEL }, 1)
33
if not model_name then
44
error("No model (--" .. private_vibescript.MODEL .. ") provided", 0)
55
end
6-
local models = get_prop(config_json, "models", {})
6+
7+
local models = get_prop("models", {})
78
local model_found = false
89
for i = 1, #models do
910
if models[i].name == model_name then
1011
models[i].isdefault = true
1112
model_found = true
12-
break
13+
else
14+
models[i].isdefault = nil
1315
end
1416
end
15-
set_prop(config_json, "models", models)
1617

1718
if not model_found then
1819
error("Model (" .. model_name .. ") does not exist", 0)
1920
end
2021

21-
private_vibescript.save_config_json(config_json)
22+
set_prop("models", models)
2223
end

0 commit comments

Comments
 (0)