Skip to content

Commit 89f35b0

Browse files
octohedron0xToshii
andauthored
Fix undefined type during chunk streaming (RooCodeInc#1464)
* Fix undefined type when parsing response chunk in stream * Fix undefined type when parsing response chunk in stream * remove Cline.ts changes --------- Co-authored-by: 0xtoshii <[email protected]>
1 parent d7f30fd commit 89f35b0

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/api/providers/anthropic.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class AnthropicHandler implements ApiHandler {
133133
}
134134

135135
for await (const chunk of stream) {
136-
switch (chunk.type) {
136+
switch (chunk?.type) {
137137
case "message_start":
138138
// tells us cache reads/writes/input/output
139139
const usage = chunk.message.usage

src/api/providers/bedrock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class AwsBedrockHandler implements ApiHandler {
120120
)
121121

122122
for await (const chunk of stream) {
123-
switch (chunk.type) {
123+
switch (chunk?.type) {
124124
case "message_start":
125125
const usage = chunk.message.usage
126126
yield {

src/api/providers/vertex.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export class VertexHandler implements ApiHandler {
154154
}
155155

156156
for await (const chunk of stream) {
157-
switch (chunk.type) {
157+
switch (chunk?.type) {
158158
case "message_start":
159159
const usage = chunk.message.usage
160160
yield {

0 commit comments

Comments
 (0)