Commit 618456f2 authored by 박민석's avatar 박민석

update api

parent a39d83db
Pipeline #21100 passed with stages
in 3 minutes and 47 seconds
......@@ -189,24 +189,23 @@
body: JSON.stringify(payload),
})
.then((response) => {
// const reader = response.body?.getReader()
// const decoder = new TextDecoder('utf-8')
const reader = response.body?.getReader()
const decoder = new TextDecoder('utf-8')
// function readStream () {
// return reader?.read().then(({ done, value }) => {
// if (done) {
// isLoading = false
// return
// }
// const chunk = decoder.decode(value, { stream: true })
// messageItem.textContent += chunk
// chatBody.scrollTop = chatBody?.scrollHeight
// return readStream()
// })
// }
// return readStream()
console.log(response)
function readStream () {
return reader?.read().then(({ done, value }) => {
if (done) {
isLoading = false
return
}
const chunk = decoder.decode(value, { stream: true })
messageItem.textContent += chunk
chatBody.scrollTop = chatBody?.scrollHeight
return readStream()
})
}
return readStream()
})
.catch((error) => {
console.error('Chatbot Error', error)
......
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