Skip to content

Commit bb82122

Browse files
authored
Update script.js
1 parent 36fb55c commit bb82122

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

script.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ form.addEventListener("submit", async (e) => {
4343

4444
const data = await response.json();
4545
threadId = data.thread_id;
46-
4746
} catch (err) {
48-
appendMessage("agent-message", "Er ging iets mis bij het ophalen van een antwoord.");
47+
appendMessage("agent-message", "⚠️ Er ging iets mis bij het ophalen van een antwoord.");
4948
console.error("Fout in fetch:", err);
5049
}
5150
});
@@ -66,16 +65,20 @@ function appendFormattedMessage(cssClass, htmlContent) {
6665
chat.scrollTop = chat.scrollHeight;
6766
}
6867

69-
// ✅ SignalR verbinden en tokens verwerken
68+
// ✅ SignalR setup
7069
const connection = new signalR.HubConnectionBuilder()
71-
.withUrl("https://chatproxy.azurewebsites.net/api")
70+
.withUrl("https://chatproxy.azurewebsites.net/api/negotiate", {
71+
withCredentials: false // ✅ voorkom CORS-misconfiguratie
72+
})
73+
.configureLogging(signalR.LogLevel.Information)
7274
.build();
7375

7476
connection.on("newToken", token => {
75-
streamOutput.textContent += token + " ";
77+
streamOutput.textContent += token;
7678
chat.scrollTop = chat.scrollHeight;
7779
});
7880

79-
connection.start()
80-
.then(() => console.log("Verbonden met SignalR"))
81-
.catch(err => console.error("SignalR fout:", err));
81+
connection
82+
.start()
83+
.then(() => console.log("✅ Verbonden met SignalR"))
84+
.catch(err => console.error("❌ SignalR fout:", err));

0 commit comments

Comments
 (0)