Skip to content

Commit c302fbe

Browse files
committed
fix(html): write text not html
1 parent 33fb7dc commit c302fbe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pages/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export default function Page() {
164164
reset()
165165
if (bioNode.current) {
166166
console.log("resetting")
167-
bioNode.current.innerHTML = ""
167+
bioNode.current.innerText = ""
168168
}
169169
},
170170
onClose: () => {
@@ -179,7 +179,7 @@ export default function Page() {
179179
...prev.history,
180180
{
181181
speaker: "bot",
182-
text: bioNode.current?.innerHTML.replace(/<br>/g, "\n") as string,
182+
text: bioNode.current?.innerText.replace(/<br>/g, "\n") as string,
183183
},
184184
],
185185
}
@@ -198,7 +198,7 @@ export default function Page() {
198198
}
199199
try {
200200
let text = JSON.parse(data).choices[0].text
201-
bioNode.current.innerHTML = bioNode.current.innerHTML + text
201+
bioNode.current.innerText = bioNode.current.innerText + text
202202
} catch (err) {
203203
console.log(`Failed to parse data: ${data}`)
204204
setError(`Failed to parse the response`)
@@ -207,7 +207,7 @@ export default function Page() {
207207

208208
const onSubmit: SubmitHandler<FormData> = (data) => {
209209
if (bioNode.current) {
210-
bioNode.current.innerHTML = "..."
210+
bioNode.current.innerText = "..."
211211
}
212212
setStreaming(true)
213213

0 commit comments

Comments
 (0)