The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(web_chat): update attachment handling logic
Steven Enamakel9fb3aa7519de
diff --git a/crates/openhuman-core/src/threads/ops/crud.rs b/crates/openhuman-core/src/threads/ops/crud.rsindex 70ec062b8a..3df83755fd 100644--- a/crates/openhuman-core/src/threads/ops/crud.rs+++ b/crates/openhuman-core/src/threads/ops/crud.rs@@ -499,7 +499,10 @@ pub async fn message_update(request.thread_id.clone(),request.message_id.clone(),ConversationMessagePatch {- extra_metadata: request.extra_metadata,+ // Merge public metadata inside the store's CAS retry. This keeps+ // the private attachment path map invisible to callers while+ // preventing an ordinary UI metadata update from erasing it.+ merge_extra_metadata: request.extra_metadata,..Default::default()},)diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rsindex f31e1ce00e..026b0ad52e 100644--- a/crates/openhuman-core/src/web_chat/schemas.rs+++ b/crates/openhuman-core/src/web_chat/schemas.rs@@ -10,7 +10,7 @@ use crate::core::all::{ControllerFuture, RegisteredController};use crate::core::{ControllerSchema, FieldSchema, TypeSchema};use super::ops::{- channel_web_cancel, channel_web_chat_with_stored_attachments, channel_web_queue_clear,+ channel_web_cancel, channel_web_chat_with_attachments, channel_web_queue_clear,channel_web_queue_remove, channel_web_queue_status,};use super::types::{@@ -210,11 +210,23 @@ fn handle_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture.filter(|part| !matches!(part, tinychannels_bus::ContentPart::VoiceNote { .. })).cloned().collect::<Vec<_>>();- let stored_attachments = if stored_parts.is_empty() {+ let is_queued_followup = p.queue_mode.as_deref() == Some("followup");+ let (stored_attachments, attachment_uploads) = if is_queued_followup {+ if p.persisted_message_id.is_some() {+ return Err("queued follow-ups must submit fresh attachment uploads".into());+ }+ if p.message.contains("[ATTACHMENT:")+ || p.message.contains("[IMAGE:")+ || p.message.contains("[FILE:")+ {+ return Err("typed media uploads require marker-free user text".into());+ }+ (None, (!stored_parts.is_empty()).then_some(stored_parts))+ } else if stored_parts.is_empty() {if p.persisted_message_id.is_some() {return Err("persisted_message_id requires opaque media refs".into());}- None+ (None, None)} else {crate::threads::attachments::validate_opaque_parts(&stored_parts)?;let persisted_message_id =@@ -222,12 +234,15 @@ fn handle_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture.clone().filter(|id| !id.is_empty()).ok_or_else(|| "opaque media refs require persisted_message_id".to_string())?;- Some(crate::agent::queued_turn::StoredAttachmentInput {- persisted_message_id,- parts: stored_parts,- })+ (+ Some(crate::agent::queued_turn::StoredAttachmentInput {+ persisted_message_id,+ parts: stored_parts,+ }),+ None,+ )};- let message = if stored_attachments.is_some() {+ let message = if stored_attachments.is_some() || is_queued_followup {if p.message.contains("[ATTACHMENT:")|| p.message.contains("[IMAGE:")|| p.message.contains("[FILE:")@@ -246,7 +261,7 @@ fn handle_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuturep.reasoning_effort.as_deref(),)?;to_json(- channel_web_chat_with_stored_attachments(+ channel_web_chat_with_attachments(&ctx,&p.client_id,&p.thread_id,@@ -269,6 +284,7 @@ fn handle_chat(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuture},voice_note_id,stored_attachments,+ attachment_uploads,).await?,)