mirror of
https://github.com/sst/opencode.git
synced 2025-08-22 05:54:08 +00:00
sync
This commit is contained in:
parent
bc199d32be
commit
24f0f81773
1 changed files with 2 additions and 4 deletions
|
@ -452,8 +452,6 @@ async function subscribeSessionEvents() {
|
|||
|
||||
const response = await fetch(`${server.url}/event`)
|
||||
if (!response.body) throw new Error("No response body")
|
||||
// TODO
|
||||
console.log("!@#!@#!@#! fetched", response.body)
|
||||
|
||||
const reader = response.body.getReader()
|
||||
const decoder = new TextDecoder()
|
||||
|
@ -465,10 +463,10 @@ async function subscribeSessionEvents() {
|
|||
if (done) break
|
||||
|
||||
const chunk = decoder.decode(value, { stream: true })
|
||||
console.log("!@#!@#!@#! read", chunk)
|
||||
const lines = chunk.split("\n")
|
||||
|
||||
for (const line of lines) {
|
||||
// TODO
|
||||
console.log("!@#!@#!@#! line", line)
|
||||
if (!line.startsWith("data: ")) continue
|
||||
|
||||
|
@ -478,7 +476,7 @@ async function subscribeSessionEvents() {
|
|||
try {
|
||||
const evt = JSON.parse(jsonStr)
|
||||
|
||||
if (evt.type !== "part.updated") continue
|
||||
if (evt.type !== "message.part.updated") continue
|
||||
if (evt.properties.part.sessionID !== session.id) continue
|
||||
const part = evt.properties.part
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue