"vscode:/vscode.git/clone" did not exist on "46af98267d668ae9fa61ac8a5e1e4e5c229f58d3"
Commit f4a2ae5e authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

enh: list valve

parent 0250f69d
...@@ -30,20 +30,29 @@ ...@@ -30,20 +30,29 @@
const submitHandler = async () => { const submitHandler = async () => {
saving = true; saving = true;
let res = null; if (valvesSpec) {
// Convert string to array
for (const property in valvesSpec.properties) {
if (valvesSpec.properties[property]?.type === 'array') {
valves[property] = (valves[property] ?? '').split(',').map((v) => v.trim());
}
}
if (type === 'tool') { let res = null;
res = await updateToolValvesById(localStorage.token, id, valves).catch((error) => {
toast.error(error);
});
} else if (type === 'function') {
res = await updateFunctionValvesById(localStorage.token, id, valves).catch((error) => {
toast.error(error);
});
}
if (res) { if (type === 'tool') {
toast.success('Valves updated successfully'); res = await updateToolValvesById(localStorage.token, id, valves).catch((error) => {
toast.error(error);
});
} else if (type === 'function') {
res = await updateFunctionValvesById(localStorage.token, id, valves).catch((error) => {
toast.error(error);
});
}
if (res) {
toast.success('Valves updated successfully');
}
} }
saving = false; saving = false;
...@@ -66,6 +75,15 @@ ...@@ -66,6 +75,15 @@
valves = {}; valves = {};
} }
if (valvesSpec) {
// Convert array to string
for (const property in valvesSpec.properties) {
if (valvesSpec.properties[property]?.type === 'array') {
valves[property] = (valves[property] ?? []).join(',');
}
}
}
loading = false; loading = false;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment