mirror of
https://github.com/sst/opencode.git
synced 2025-08-23 14:34: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`)
|
const response = await fetch(`${server.url}/event`)
|
||||||
if (!response.body) throw new Error("No response body")
|
if (!response.body) throw new Error("No response body")
|
||||||
// TODO
|
|
||||||
console.log("!@#!@#!@#! fetched", response.body)
|
|
||||||
|
|
||||||
const reader = response.body.getReader()
|
const reader = response.body.getReader()
|
||||||
const decoder = new TextDecoder()
|
const decoder = new TextDecoder()
|
||||||
|
@ -465,10 +463,10 @@ async function subscribeSessionEvents() {
|
||||||
if (done) break
|
if (done) break
|
||||||
|
|
||||||
const chunk = decoder.decode(value, { stream: true })
|
const chunk = decoder.decode(value, { stream: true })
|
||||||
console.log("!@#!@#!@#! read", chunk)
|
|
||||||
const lines = chunk.split("\n")
|
const lines = chunk.split("\n")
|
||||||
|
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
|
// TODO
|
||||||
console.log("!@#!@#!@#! line", line)
|
console.log("!@#!@#!@#! line", line)
|
||||||
if (!line.startsWith("data: ")) continue
|
if (!line.startsWith("data: ")) continue
|
||||||
|
|
||||||
|
@ -478,7 +476,7 @@ async function subscribeSessionEvents() {
|
||||||
try {
|
try {
|
||||||
const evt = JSON.parse(jsonStr)
|
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
|
if (evt.properties.part.sessionID !== session.id) continue
|
||||||
const part = evt.properties.part
|
const part = evt.properties.part
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue