Commit 270c16c0 authored by 박민석's avatar 박민석

log check -- msg chunk

parent b0b53cdb
Pipeline #21183 passed with stages
in 4 minutes and 20 seconds
......@@ -192,20 +192,21 @@
body: JSON.stringify(payload),
})
.then((response) => {
const reader = response.body?.getReader()
const reader = response.body.getReader()
const decoder = new TextDecoder('utf-8')
const messageItem = document.createElement('pre')
messageItem.className = 'message ai'
function readStream () {
return reader?.read().then(({ done, value }) => {
return reader.read().then(({ done, value }) => {
if (done) {
chatBody.removeChild(chatLoader)
isLoading = false
return
}
const chunk = decoder.decode(value, { stream: true })
console.log(chunk)
messageItem.textContent += chunk
chatBody.scrollTop = chatBody?.scrollHeight
return readStream()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment