@@ -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
7069const 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
7476connection . 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