Skip to content

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

refactor(chat): simplify chat send acknowledgment logic

Steven Enamakel4b018a09d119
diff --git a/app/src/services/chatService.ts b/app/src/services/chatService.ts
index 15aabbf21c..e893d89e69 100644
--- a/app/src/services/chatService.ts
+++ b/app/src/services/chatService.ts
@@ -1034,9 +1034,6 @@ export async function chatSendWithAck(params: ChatSendParams): Promise<ChatSendA
if (typeof result === 'string') {
return { requestId: result, queuedAttachments: [] };
}
- if (isStartedChatAck(result)) {
- return { requestId: result.request_id, queuedAttachments: [] };
- }
if (result == null) {
return { queuedAttachments: [] };
}
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 ccea2f355c..48ddf4d8da 100644
--- a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
+++ b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
@@ -306,13 +306,15 @@ pub async fn channel_web_chat_with_attachments(
return Ok(Outcome::single_log(parsed, "web channel message queued"));
}
- Ok(Outcome::single_log(
- crate::threads::rpc_models::StartedChatAck {
+ let accepted = serde_json::to_value(crate::threads::rpc_models::StartedChatAck {
accepted: true,
client_id: client_id.trim().to_owned(),
thread_id: thread_id.trim().to_owned(),
request_id: result,
- },
+ })
+ .map_err(|error| format!("serialize started chat ack: {error}"))?;
+ Ok(Outcome::single_log(
+ accepted,
"web channel request accepted",
))
}