diff options
| author | Dax Raad <[email protected]> | 2025-05-29 13:15:58 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-05-29 13:15:58 -0400 |
| commit | d62ce482dac7ca8b91366b9d4f9f691151140253 (patch) | |
| tree | ebcb1d20ff61e18722caf1637edf9fa1b03ee2ef /js/src/session | |
| parent | f9f41e205d83ffa74492b4238060c807afb9e249 (diff) | |
| download | opencode-d62ce482dac7ca8b91366b9d4f9f691151140253.tar.gz opencode-d62ce482dac7ca8b91366b9d4f9f691151140253.zip | |
fix race
Diffstat (limited to 'js/src/session')
| -rw-r--r-- | js/src/session/session.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/js/src/session/session.ts b/js/src/session/session.ts index 7770f2759..e773ed297 100644 --- a/js/src/session/session.ts +++ b/js/src/session/session.ts @@ -110,7 +110,8 @@ export namespace Session { const result = [] as Message.Info[]; const list = Storage.list("session/message/" + sessionID); for await (const p of list) { - const read = await Storage.readJSON<Message.Info>(p); + const read = await Storage.readJSON<Message.Info>(p).catch(() => {}); + if (!read) continue; result.push(read); } result.sort((a, b) => (a.id > b.id ? 1 : -1)); @@ -250,6 +251,7 @@ export namespace Session { tool: {}, }, }; + await updateMessage(next); const result = streamText({ onStepFinish: async (step) => { const assistant = next.metadata!.assistant!; @@ -266,8 +268,6 @@ export namespace Session { tools, model: model.instance, }); - - msgs.push(next); let text: Message.TextPart | undefined; const reader = result.toUIMessageStream().getReader(); while (true) { |
