Commit ·
6c9bf1e
1
Parent(s): f7559d3
Fix ownership issue in orchestrator streaming
Browse files- src/orchestrator.rs +4 -5
src/orchestrator.rs
CHANGED
|
@@ -30,13 +30,11 @@ pub struct TriageOutput {
|
|
| 30 |
pub agent_steps: Vec<AgentStep>,
|
| 31 |
}
|
| 32 |
|
| 33 |
-
// Non‑streaming version for regular /triage
|
| 34 |
pub async fn run_triage(patient_note: &str) -> Result<TriageOutput> {
|
| 35 |
let (tx, _) = tokio::sync::mpsc::channel(10);
|
| 36 |
run_triage_stream(patient_note.to_string(), tx).await
|
| 37 |
}
|
| 38 |
|
| 39 |
-
// Streaming version for /triage/stream
|
| 40 |
pub async fn run_triage_stream(
|
| 41 |
patient_note: String,
|
| 42 |
tx: Sender<Result<Event, Infallible>>,
|
|
@@ -78,7 +76,8 @@ pub async fn run_triage_stream(
|
|
| 78 |
.await?;
|
| 79 |
|
| 80 |
let mut triage_result = String::new();
|
| 81 |
-
|
|
|
|
| 82 |
use futures::StreamExt;
|
| 83 |
let mut stream = resp.bytes_stream();
|
| 84 |
while let Some(chunk) = stream.next().await {
|
|
@@ -105,8 +104,8 @@ pub async fn run_triage_stream(
|
|
| 105 |
serde_json::json!({"agent":"Triage","token":&triage_result}).to_string()
|
| 106 |
))).await;
|
| 107 |
}
|
| 108 |
-
let model_used = if
|
| 109 |
-
let device_info = if
|
| 110 |
steps.push(AgentStep {
|
| 111 |
name: "Triage".into(),
|
| 112 |
status: "completed".into(),
|
|
|
|
| 30 |
pub agent_steps: Vec<AgentStep>,
|
| 31 |
}
|
| 32 |
|
|
|
|
| 33 |
pub async fn run_triage(patient_note: &str) -> Result<TriageOutput> {
|
| 34 |
let (tx, _) = tokio::sync::mpsc::channel(10);
|
| 35 |
run_triage_stream(patient_note.to_string(), tx).await
|
| 36 |
}
|
| 37 |
|
|
|
|
| 38 |
pub async fn run_triage_stream(
|
| 39 |
patient_note: String,
|
| 40 |
tx: Sender<Result<Event, Infallible>>,
|
|
|
|
| 76 |
.await?;
|
| 77 |
|
| 78 |
let mut triage_result = String::new();
|
| 79 |
+
let is_success = resp.status().is_success();
|
| 80 |
+
if is_success {
|
| 81 |
use futures::StreamExt;
|
| 82 |
let mut stream = resp.bytes_stream();
|
| 83 |
while let Some(chunk) = stream.next().await {
|
|
|
|
| 104 |
serde_json::json!({"agent":"Triage","token":&triage_result}).to_string()
|
| 105 |
))).await;
|
| 106 |
}
|
| 107 |
+
let model_used = if is_success { "7B (vLLM)" } else { "mock" };
|
| 108 |
+
let device_info = if is_success { "ROCm/MI300X" } else { "CPU (fallback)" };
|
| 109 |
steps.push(AgentStep {
|
| 110 |
name: "Triage".into(),
|
| 111 |
status: "completed".into(),
|