Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/opencode/src/session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,7 @@ export namespace Session {
try {
let currentText: MessageV2.TextPart | undefined
let reasoningMap: Record<string, MessageV2.ReasoningPart> = {}
let tollCalled = false;

for await (const value of stream.fullStream) {
log.info("part", {
Expand Down Expand Up @@ -1219,6 +1220,7 @@ export namespace Session {
break

case "tool-call": {
tollCalled = true;
const match = toolcalls[value.toolCallId]
if (match) {
const part = await updatePart({
Expand Down Expand Up @@ -1254,6 +1256,7 @@ export namespace Session {
},
})
delete toolcalls[value.toolCallId]
tollCalled = false;
}
break
}
Expand Down Expand Up @@ -1337,14 +1340,14 @@ export namespace Session {
break

case "text-delta":
if (currentText) {
if (currentText && !tollCalled) {
currentText.text += value.text
if (currentText.text) await updatePart(currentText)
}
break

case "text-end":
if (currentText) {
if (currentText && !tollCalled) {
currentText.text = currentText.text.trimEnd()
currentText.time = {
start: Date.now(),
Expand Down