Skip to content

Commit 5ac1b73

Browse files
authored
Update script.js
1 parent 7e3ed62 commit 5ac1b73

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

script.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ form.addEventListener("submit", async (e) => {
1717
body: JSON.stringify({ message })
1818
});
1919

20-
const text = await response.text();
21-
console.log("Responsetekst:", text);
22-
2320
if (!response.ok) {
2421
throw new Error(`Serverfout: ${response.status}`);
2522
}
2623

27-
appendMessage("Agent", text);
24+
const data = await response.json();
25+
const output = data.tool_output || "Geen antwoord ontvangen.";
26+
appendMessage("Agent", output);
27+
2828
} catch (err) {
29-
appendMessage("Agent", "Er ging iets mis bij het ophalen van het zorgdocument.");
29+
appendMessage("Agent", "Er ging iets mis.");
3030
console.error("Fout in fetch:", err);
3131
}
3232
});
@@ -37,3 +37,4 @@ function appendMessage(sender, text) {
3737
chat.appendChild(msg);
3838
chat.scrollTop = chat.scrollHeight;
3939
}
40+

0 commit comments

Comments
 (0)