whoosh 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/whoosh/app.rb +2 -23
- data/lib/whoosh/endpoint.rb +2 -0
- data/lib/whoosh/streaming/helpers.rb +29 -0
- data/lib/whoosh/version.rb +1 -1
- data/lib/whoosh.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b74890ede8ed95aadeafdd55439b0a267ec521ecb5c84fd879807f29789a9d9a
|
|
4
|
+
data.tar.gz: aa04e3dbf492846d8f06fe057ef657a137065a6b8069421c24013a4102b63511
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 884921ba3182cef85545192b08301ced1d992705621ce0860e55e916da2ece5f8d1b122f676a88e0e7b18dcbb9f271e01e2e46bbd5439962cd476bfb73173078
|
|
7
|
+
data.tar.gz: 8dcb16978fa00228a18de47e42cbe29c0e3d8da84c3bf3a6b4b52842ea9ce4cbcc7a5930b1c471c8b2d06065b6793db6574a8ec2392e7f9707e07d73940be0fb
|
data/lib/whoosh/app.rb
CHANGED
|
@@ -211,29 +211,8 @@ module Whoosh
|
|
|
211
211
|
end
|
|
212
212
|
end
|
|
213
213
|
|
|
214
|
-
# --- Streaming helpers ---
|
|
215
|
-
|
|
216
|
-
def stream(type, &block)
|
|
217
|
-
case type
|
|
218
|
-
when :sse
|
|
219
|
-
body = Streaming::StreamBody.new do |out|
|
|
220
|
-
sse = Streaming::SSE.new(out)
|
|
221
|
-
block.call(sse)
|
|
222
|
-
end
|
|
223
|
-
[200, Streaming::SSE.headers, body]
|
|
224
|
-
else
|
|
225
|
-
raise ArgumentError, "Unknown stream type: #{type}"
|
|
226
|
-
end
|
|
227
|
-
end
|
|
228
|
-
|
|
229
|
-
def stream_llm(&block)
|
|
230
|
-
body = Streaming::StreamBody.new do |out|
|
|
231
|
-
llm_stream = Streaming::LlmStream.new(out)
|
|
232
|
-
block.call(llm_stream)
|
|
233
|
-
llm_stream.finish
|
|
234
|
-
end
|
|
235
|
-
[200, Streaming::LlmStream.headers, body]
|
|
236
|
-
end
|
|
214
|
+
# --- Streaming helpers (stream, stream_llm) ---
|
|
215
|
+
include Streaming::Helpers
|
|
237
216
|
|
|
238
217
|
# WebSocket endpoint helper — use in handle_request, returns hijack response
|
|
239
218
|
def websocket(env, &block)
|
data/lib/whoosh/endpoint.rb
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Whoosh
|
|
4
|
+
module Streaming
|
|
5
|
+
module Helpers
|
|
6
|
+
def stream(type, &block)
|
|
7
|
+
case type
|
|
8
|
+
when :sse
|
|
9
|
+
body = StreamBody.new do |out|
|
|
10
|
+
sse = SSE.new(out)
|
|
11
|
+
block.call(sse)
|
|
12
|
+
end
|
|
13
|
+
[200, SSE.headers, body]
|
|
14
|
+
else
|
|
15
|
+
raise ArgumentError, "Unknown stream type: #{type}"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def stream_llm(&block)
|
|
20
|
+
body = StreamBody.new do |out|
|
|
21
|
+
llm_stream = LlmStream.new(out)
|
|
22
|
+
block.call(llm_stream)
|
|
23
|
+
llm_stream.finish
|
|
24
|
+
end
|
|
25
|
+
[200, LlmStream.headers, body]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/lib/whoosh/version.rb
CHANGED
data/lib/whoosh.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: whoosh
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Johannes Dwi Cahyo
|
|
@@ -264,6 +264,7 @@ files:
|
|
|
264
264
|
- lib/whoosh/storage.rb
|
|
265
265
|
- lib/whoosh/storage/local.rb
|
|
266
266
|
- lib/whoosh/storage/s3.rb
|
|
267
|
+
- lib/whoosh/streaming/helpers.rb
|
|
267
268
|
- lib/whoosh/streaming/llm_stream.rb
|
|
268
269
|
- lib/whoosh/streaming/sse.rb
|
|
269
270
|
- lib/whoosh/streaming/stream_body.rb
|