File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -17,15 +17,13 @@ form.addEventListener("submit", async (e) => {
1717 body : JSON . stringify ( { message } )
1818 } ) ;
1919
20- if ( ! response . ok ) {
21- throw new Error ( `Serverfout ( ${ response . status } )` ) ;
22- }
20+ // LET OP: geen .json() gebruiken, want backend stuurt platte tekst terug
21+ const text = await response . text ( ) ;
22+ appendMessage ( "Agent" , text ) ;
2323
24- const result = await response . json ( ) ;
25- appendMessage ( "Agent" , result . tool_output || "Geen antwoord ontvangen." ) ;
2624 } catch ( err ) {
2725 appendMessage ( "Agent" , "Er ging iets mis." ) ;
28- console . error ( "Fout in webchat:" , err ) ;
26+ console . error ( err ) ;
2927 }
3028} ) ;
3129
@@ -35,3 +33,4 @@ function appendMessage(sender, text) {
3533 chat . appendChild ( msg ) ;
3634 chat . scrollTop = chat . scrollHeight ;
3735}
36+
You can’t perform that action at this time.
0 commit comments