Skip to content

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

feat(web_chat): support message input from stored attachments

Steven Enamakelb5ecb14e1c4c
diff --git a/crates/openhuman-core/src/web_chat/turn_host.rs b/crates/openhuman-core/src/web_chat/turn_host.rs
index ea3ef28259..99cd574f02 100644
--- a/crates/openhuman-core/src/web_chat/turn_host.rs
+++ b/crates/openhuman-core/src/web_chat/turn_host.rs
@@ -275,6 +275,22 @@ impl WebHost {
},
);
+ let message_input = if let Some(stored) = payload.stored_attachments.as_ref() {
+ let parts = crate::threads::attachments::resolve_persisted_parts(
+ &ctx,
+ thread_id,
+ &stored.persisted_message_id,
+ &stored.parts,
+ )
+ .await?;
+ Some(crate::agent::message_convert::user_message_from_parts(
+ &request.text,
+ &parts,
+ )?)
+ } else {
+ None
+ };
+
// `run_single`'s future is very large; box it so the origin scope holds
// a pointer rather than inlining it into this frame.
#[cfg(feature = "tinymemes")]
@@ -283,7 +299,7 @@ impl WebHost {
agent,
crate::agent::turn_host::AgentTurnRequest {
message: request.text.clone(),
- message_input: None,
+ message_input,
thread_id: Some(thread_id.to_owned()),
origin,
approval,