Skip to content

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

feat(web_chat): add support for stored attachments in channel chat

Steven Enamakel49bd470e123e
diff --git a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
index 9ddf9e35a3..d5f9d8eac6 100644
--- a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
+++ b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
@@ -13,7 +13,8 @@ use crate::web_chat::WebChannelEvent;
use super::super::event_bus::publish_web_channel_event_in;
use super::super::runner::{runtime, scope_of, CancelNote};
use super::super::types::ChatRequestMetadata;
-use super::start_chat::start_chat_with_voice_note;
+use crate::agent::queued_turn::StoredAttachmentInput;
+use super::start_chat::start_chat_with_stored_attachments;
/// Cancel the in-flight turn(s) for a thread.
///
@@ -201,6 +202,37 @@ pub async fn channel_web_chat(
run_mode: Option<String>,
metadata: ChatRequestMetadata,
voice_note_id: Option<String>,
+) -> Result<Outcome<Value>, String> {
+ channel_web_chat_with_stored_attachments(
+ ctx,
+ client_id,
+ thread_id,
+ message,
+ model_override,
+ temperature,
+ locale,
+ queue_mode,
+ run_mode,
+ metadata,
+ voice_note_id,
+ None,
+ )
+ .await
+}
+
+pub async fn channel_web_chat_with_stored_attachments(
+ ctx: &crate::core::runtime::DispatchCtx,
+ client_id: &str,
+ thread_id: &str,
+ message: &str,
+ model_override: Option<String>,
+ temperature: Option<f64>,
+ locale: Option<String>,
+ queue_mode: Option<String>,
+ run_mode: Option<String>,
+ metadata: ChatRequestMetadata,
+ voice_note_id: Option<String>,
+ stored_attachments: Option<StoredAttachmentInput>,
) -> Result<Outcome<Value>, String> {
// A SaaS user chooses the thread id; the same rules as `threads_upsert`
// apply (no reserved prefixes, no path-like ids). No-op outside SaaS.
@@ -222,7 +254,7 @@ pub async fn channel_web_chat(
}
}
- let result = start_chat_with_voice_note(
+ let result = start_chat_with_stored_attachments(
ctx,
client_id,
thread_id,
@@ -233,6 +265,7 @@ pub async fn channel_web_chat(
queue_mode,
metadata,
voice_note_id,
+ stored_attachments,
)
.await?;