Skip to content

Commit 0dcd6ac

Browse files
committed
refac
1 parent 93415a4 commit 0dcd6ac

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/lib/components/chat/MessageInput/InputVariablesModal.svelte

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,17 @@
3333
3434
const init = async () => {
3535
loading = true;
36-
variableValues = {};
37-
for (const variable of Object.keys(variables)) {
38-
if (variables[variable]?.default !== undefined) {
39-
variableValues[variable] = variables[variable].default;
36+
const newValues = {};
37+
const keys = Object.keys(variables ?? {});
38+
for (const key of keys) {
39+
const variable = variables[key];
40+
if (variable?.default !== undefined) {
41+
newValues[key] = variable.default;
4042
} else {
41-
variableValues[variable] = '';
43+
newValues[key] = '';
4244
}
4345
}
46+
variableValues = newValues;
4447
loading = false;
4548
4649
await tick();

0 commit comments

Comments
 (0)