From 0d3f1589c13418f0b4eb018acca36ae6daae457d Mon Sep 17 00:00:00 2001 From: dal Date: Fri, 18 Apr 2025 15:15:36 -0600 Subject: [PATCH] now returns yml in the raw messages --- api/libs/handlers/src/chats/restore_chat_handler.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/api/libs/handlers/src/chats/restore_chat_handler.rs b/api/libs/handlers/src/chats/restore_chat_handler.rs index 7c348ecb6..da515bb19 100644 --- a/api/libs/handlers/src/chats/restore_chat_handler.rs +++ b/api/libs/handlers/src/chats/restore_chat_handler.rs @@ -142,8 +142,9 @@ pub async fn restore_chat_handler( .select(metric_files::content) .first::(&mut conn) .await?; - // Convert JSON Value to String - content_json.to_string() + // Convert JSON Value to pretty YAML String + serde_yaml::to_string(&content_json) + .map_err(|e| anyhow!("Failed to convert metric content to YAML: {}", e))? } AssetType::DashboardFile => { let content_json = dashboard_files::table @@ -151,8 +152,9 @@ pub async fn restore_chat_handler( .select(dashboard_files::content) .first::(&mut conn) .await?; - // Convert JSON Value to String for the message - content_json.to_string() + // Convert JSON Value to pretty YAML String for the message + serde_yaml::to_string(&content_json) + .map_err(|e| anyhow!("Failed to convert dashboard content to YAML: {}", e))? } // This case should be unreachable due to the check in the restore_task _ => {