feat: add SSE streaming support (OpenAI-compatible)
- Token-by-token streaming via Server-Sent Events - tokio::sync::mpsc channel + ReceiverStream for clean async - OpenAI SSE format: role chunk → content chunks → finish chunk - Non-streaming still works with the same code path - Uses spawn_blocking pattern for CPU-bound inference
This commit is contained in:
@@ -10,6 +10,7 @@ llama-cpp-2 = "0.1"
|
||||
# HTTP server
|
||||
axum = { version = "0.8", features = ["json"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tokio-stream = "0.1"
|
||||
tower-http = { version = "0.6", features = ["cors", "trace"] }
|
||||
|
||||
# Serialization
|
||||
@@ -22,3 +23,4 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
anyhow = "1"
|
||||
uuid = { version = "1", features = ["v4"] }
|
||||
chrono = { version = "0.4", features = ["serde"] }
|
||||
futures = "0.3"
|
||||
|
||||
Reference in New Issue
Block a user