From 5de8bfab03dacd57490751d856091d7f88e568a3 Mon Sep 17 00:00:00 2001 From: YokiiroBW Date: Tue, 21 Jul 2026 14:55:49 +0800 Subject: [PATCH] fix(chat): flatten runtime event payloads --- docs/progress.md | 6 ++++++ src-tauri/src/networking/astrbot_client.rs | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/progress.md b/docs/progress.md index c87381a..b5dad34 100644 --- a/docs/progress.md +++ b/docs/progress.md @@ -294,3 +294,9 @@ Still not claimed complete: automatic startup activation, real Tauri multi-windo - Reconciled final text with partial `plain` chunks and added support for text nested under `text`, `content`, or `message` fields. - Added protocol tests for complete-only replies and partial-stream reconciliation. - Validation: Rust format, Clippy with warnings denied, Rust workspace tests (67), TypeScript, ESLint, and NSIS bundle build pass. + +## 2026-07-21: normalize runtime event payloads + +- Fixed AstrBot runtime event dispatch to expose the inner payload directly instead of nesting it under the protocol envelope. +- This restores frontend and database access to `delta`, `content`, and error `message` fields. +- Validation: Rust workspace tests, Clippy with warnings denied, TypeScript, ESLint, and NSIS bundle build pass. diff --git a/src-tauri/src/networking/astrbot_client.rs b/src-tauri/src/networking/astrbot_client.rs index b720e76..b1b2896 100644 --- a/src-tauri/src/networking/astrbot_client.rs +++ b/src-tauri/src/networking/astrbot_client.rs @@ -468,8 +468,9 @@ impl AstrBotClient { } drop(seen); - let payload = serde_json::to_value(&event.body) + let body = serde_json::to_value(&event.body) .map_err(|error| AstrBotClientError::Map(error.to_string()))?; + let payload = body.get("payload").cloned().unwrap_or(body); let bound = BoundGatewayEvent { profile_id: self.config.profile_id.clone(), slot: protocol_slot(self.config.slot),