Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(web_chat): use structured response for queued chat ack

Steven Enamakele760e51c1d2d
diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
index 49fe1870fa..2fa153dc45 100644
--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs
+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
@@ -440,18 +440,18 @@ async fn start_chat_inner(
item_id: Some(request_id.clone()),
text_preview: Some(preview),
});
- Ok(json!({
- "queued": true,
- "queue_mode": mode.to_string(),
- "client_id": client_id,
- "thread_id": thread_id,
- "request_id": request_id,
- "queue_depth": queue_depth,
- "queued_attachments": pending_attachments
+ serde_json::to_string(&super::super::types::QueuedChatAck {
+ queued: true,
+ queue_mode: mode.to_string(),
+ client_id,
+ thread_id,
+ request_id,
+ queue_depth,
+ queued_attachments: pending_attachments
.map(|input| input.parts)
.unwrap_or_default(),
})
- .to_string())
+ .map_err(|error| StartChatError::Other(format!("serialize queued chat ack: {error}")))
}
}
}