save state bettr

This commit is contained in:
dal 2025-03-11 09:35:44 -06:00
parent ea7ca17b16
commit dbf77e4b68
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
4 changed files with 17 additions and 3 deletions

View File

@ -95,6 +95,8 @@ pub async fn validate_metric_ids(ids: &[Uuid]) -> Result<Vec<Uuid>> {
}
pub const METRIC_YML_SCHEMA: &str = r##"
Please output in the order specified below.
# METRIC CONFIGURATION - YML STRUCTURE
# -------------------------------------
# Required top-level fields:
@ -486,6 +488,8 @@ definitions:
"##;
pub const DASHBOARD_YML_SCHEMA: &str = r##"
Please output in the order specified below.
# DASHBOARD CONFIGURATION - YML STRUCTURE
# ----------------------------------------
# Required fields:

View File

@ -9,6 +9,7 @@ use crate::{agent::Agent, tools::ToolExecutor};
#[derive(Debug, Serialize, Deserialize)]
pub struct CreatePlanOutput {
pub message: String,
pub plan_markdown: String,
}
#[derive(Debug, Deserialize)]
@ -42,6 +43,7 @@ impl ToolExecutor for CreatePlan {
Ok(CreatePlanOutput {
message: "Plan created successfully".to_string(),
plan_markdown: params.plan_markdown,
})
}

View File

@ -153,7 +153,7 @@ pub async fn get_chat_handler(chat_id: &Uuid, user_id: &Uuid) -> Result<ChatWith
request_message,
response_messages,
reasoning,
None,
Some(msg.final_reasoning_message),
)
})
.collect();

View File

@ -1003,12 +1003,20 @@ fn transform_tool_message(
fn tool_create_plan(id: String, content: String) -> Result<Vec<BusterReasoningMessage>> {
println!("MESSAGE_STREAM: Processing tool create plan message");
let plan_markdown = match serde_json::from_str::<CreatePlanOutput>(&content) {
Ok(result) => result.plan_markdown,
Err(e) => {
println!("Failed to parse CreatePlanOutput: {:?}", e);
return Ok(vec![]);
}
};
let buster_file = BusterReasoningMessage::Text(BusterReasoningText {
id,
reasoning_type: "text".to_string(),
title: "Plan".to_string(),
secondary_title: "".to_string(),
message: None,
message: Some(plan_markdown),
message_chunk: None,
status: Some("completed".to_string()),
});
@ -1049,7 +1057,7 @@ fn tool_create_metrics(id: String, content: String) -> Result<Vec<BusterReasonin
version_id: file.id.to_string(),
status: "completed".to_string(),
file: BusterFileContent {
text: None,
text: Some(file.yml_content),
text_chunk: None,
modifided: None,
},