Skip to content

Commit 602c0d7

Browse files
feat: Revert broken finished SSE yield config
1 parent 54de3d9 commit 602c0d7

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 8
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-573d364768ac1902ee5ed8b2485d3b293bda0ea8ff7898aef1a3fd6be79b594a.yml
33
openapi_spec_hash: 107ec840f4330885dd2232a05a66fed7
4-
config_hash: ab1c1122e862f9bdb6db4df36d489701
4+
config_hash: 0209737a4ab2a71afececb0ff7459998

lib/stagehand/internal/stream.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ class Stream
1616
# @return [Enumerable<generic<Elem>>]
1717
private def iterator
1818
# rubocop:disable Metrics/BlockLength
19-
# rubocop:disable Lint/DuplicateBranch
2019
@iterator ||= Stagehand::Internal::Util.chain_fused(@stream) do |y|
20+
consume = false
21+
2122
@stream.each do |msg|
23+
next if consume
24+
2225
case msg
2326
in {data: String => data} if data.start_with?("{\"data\":{\"status\":\"finished\"")
24-
decoded = JSON.parse(data, symbolize_names: true)
25-
unwrapped = Stagehand::Internal::Util.dig(decoded, @unwrap)
26-
y << Stagehand::Internal::Type::Converter.coerce(@model, unwrapped)
27+
consume = true
28+
next
2729
in {data: String => data} if data.start_with?("error")
2830
decoded = Kernel.then do
2931
JSON.parse(data, symbolize_names: true)
@@ -47,7 +49,6 @@ class Stream
4749
end
4850
end
4951
end
50-
# rubocop:enable Lint/DuplicateBranch
5152
# rubocop:enable Metrics/BlockLength
5253
end
5354
end

0 commit comments

Comments
 (0)