Skip to content

Commit 68579b9

Browse files
authored
Update script.js
1 parent 5ac1b73 commit 68579b9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

script.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ form.addEventListener("submit", async (e) => {
1818
});
1919

2020
if (!response.ok) {
21+
const errorText = await response.text();
22+
appendMessage("Agent", `Fout: ${errorText}`);
2123
throw new Error(`Serverfout: ${response.status}`);
2224
}
2325

2426
const data = await response.json();
25-
const output = data.tool_output || "Geen antwoord ontvangen.";
26-
appendMessage("Agent", output);
27-
27+
appendMessage("Agent", data.text);
2828
} catch (err) {
29-
appendMessage("Agent", "Er ging iets mis.");
3029
console.error("Fout in fetch:", err);
30+
appendMessage("Agent", "Er ging iets mis.");
3131
}
3232
});
3333

@@ -37,4 +37,3 @@ function appendMessage(sender, text) {
3737
chat.appendChild(msg);
3838
chat.scrollTop = chat.scrollHeight;
3939
}
40-

0 commit comments

Comments
 (0)