File tree 1 file changed +7
-2
lines changed
resources/views/components/page
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 19
19
<div class =" d-flex flex-row justify-content-end mb-4" >
20
20
<div class =" p-3 me-3 border bg-body-tertiary"
21
21
style =" border-radius : 15px ; max-width : 75% ;" >
22
- <p class =" small mb-0" x-text =" msg.text" ></p >
22
+ <p class =" small mb-0" x-html =" msg.text" style = " white-space : pre ; " ></p >
23
23
</div >
24
24
<img class =" rounded-circle h-100" :src =" userAvatar" alt =" avatar 1"
25
25
style =" width : 45px ;" >
@@ -80,6 +80,11 @@ class="form-control bg-body-tertiary border-1" id="promptTextArea" rows="4" x-bi
80
80
}, ],
81
81
chatMessages: null ,
82
82
renderedChatMessages: null ,
83
+ stripTags (html ) {
84
+ const div = document .createElement (" div" );
85
+ div .innerHTML = html;
86
+ return div .textContent || div .innerText || " " ;
87
+ },
83
88
init () {
84
89
this .aiClient = new AiTeacherApi (this .aiChatUrl );
85
90
this .scrollArea = document .getElementById (' scrollArea' );
@@ -120,7 +125,7 @@ class="form-control bg-body-tertiary border-1" id="promptTextArea" rows="4" x-bi
120
125
});
121
126
if (! this .loading && this .message ? .length > 0 ) {
122
127
let messageObj = {
123
- text: this .message ,
128
+ text: this .stripTags ( this . message ). replaceAll ( ' \n ' , ' <br> ' ) ,
124
129
date: new Date ().toLocaleString (),
125
130
isTeacher: false
126
131
};
You can’t perform that action at this time.
0 commit comments