Skip to content

Commit d0f5727

Browse files
committed
fix(stream): consume canonical text deltas only
1 parent 614db1b commit d0f5727

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎src/main/java/io/github/easy4j/opencode/api/OpenCodeChatClient.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,11 @@ private void handleEvent(String sessionId, SseEvent event, StreamingChatResponse
249249
if (Objects.isNull(type)) {
250250
return;
251251
}
252-
if (type.contains("text.delta") || type.contains("message.part.updated")) {
252+
if (type.contains("text.delta")) {
253253
stream.acceptDelta(extractDeltaText(event));
254+
} else if (type.contains("message.part.delta")
255+
&& Objects.equals("text", Objects.toString(event.getProperties().get("field"), null))) {
256+
stream.acceptDelta(Objects.toString(event.getProperties().get("delta"), null));
254257
}
255258
if (type.contains("session.status") || type.contains("session.idle")) {
256259
String status = Objects.toString(event.getProperties().get("status"), null);

0 commit comments

Comments
 (0)