From be2d31f0e1f252898b1fe27c5c3f00e0c0e42c8d Mon Sep 17 00:00:00 2001 From: Jelson Stoelben Rodrigues Date: Sat, 16 Aug 2025 07:20:21 -0300 Subject: [PATCH] chore: update system prompt --- src/main.rs | 71 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 12 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1d9fce6..5019431 100644 --- a/src/main.rs +++ b/src/main.rs @@ -166,8 +166,8 @@ fn main() { let formatted_day_before = day_before_at_midnight.format("%Y-%m-%d").to_string(); // Create a folder named with the day_before - if !std::fs::exists(format!("{formatted_day_before}")).unwrap() { - std::fs::create_dir(format!("{formatted_day_before}")).expect("Failed to create directory") + if !std::fs::exists(format!("./evaluations/{formatted_day_before}")).unwrap() { + std::fs::create_dir(format!("./evaluations/{formatted_day_before}")).expect("Failed to create directory") } let start_of_talk_code: String = "talk_start".to_string(); @@ -175,17 +175,21 @@ fn main() { // API V2 let report_type = "consolidated".to_string(); + let page = "1".to_string(); + let per_page = "30".to_string(); let talks_request = client .get(format!("https://{}/api/v2/reports/talks", PIPERUN_API_URL)) .bearer_auth(&access_token) .header("Content-Type", "application/json") .header("Accept", "application/json") .query(&[ - ("report_type", report_type), - ("start_date", formatted_day_before_at_midnight), - ("end_date", formatted_day_before_at_23_59_59), - ("date_range_type", start_of_talk_code), - ("queue_id[]", support_queue_id), + ("page", page.clone()), + ("perPage", per_page.clone()), + ("report_type", report_type.clone()), + ("start_date", formatted_day_before_at_midnight.clone()), + ("end_date", formatted_day_before_at_23_59_59.clone()), + ("date_range_type", start_of_talk_code.clone()), + ("queue_id[]", support_queue_id.clone()), ]); println!("Sending request for consolidated talks... {talks_request:?}"); @@ -194,7 +198,6 @@ fn main() { Ok(resp) => { if resp.status().is_success() { let json: serde_json::Value = resp.json().unwrap(); - // println!("Consolidated talks response: {:?}", json); json } else { @@ -215,7 +218,49 @@ fn main() { .as_array() .expect("Failed to parse talks response as array"); - // talks_array.iter().for_each(|talk| println!("{talk}")); + // let next_page_url = talks["next_page_url"].as_str().unwrap(); + // let second_page_talks_array = if talks["current_page"].as_i64().unwrap() != talks["last_page"].as_i64().unwrap() { + // let talks_request = client + // .get(format!("{}", next_page_url)) + // .bearer_auth(&access_token) + // .header("Content-Type", "application/json") + // .header("Accept", "application/json") + // .query(&[ + // ("report_type", report_type.clone()), + // ("start_date", formatted_day_before_at_midnight.clone()), + // ("end_date", formatted_day_before_at_23_59_59.clone()), + // ("date_range_type", start_of_talk_code.clone()), + // ("queue_id[]", support_queue_id.clone()), + // ]); + + // println!("Sending request for consolidated talks... {talks_request:?}"); + // let talks_response = talks_request.send(); + // let talks = match talks_response { + // Ok(resp) => { + // if resp.status().is_success() { + // let json: serde_json::Value = resp.json().unwrap(); + // // println!("Consolidated talks response: {:?}", json); + + // json + // } else { + // eprintln!("Failed to get consolidated talks: {}", resp.status()); + // let json: serde_json::Value = resp.json().unwrap(); + // eprintln!("Response body: {:?}", json); + // panic!("Failed to retrieve consolidated talks from Piperun API"); + // } + // } + // Err(e) => { + // eprintln!("Error sending request for consolidated talks: {}", e); + // panic!("Failed to send request for consolidated talks to Piperun API"); + // } + // }; + + // talks["data"] + // .as_array() + // .expect("Failed to parse talks response as array").clone() + // } + // else {Vec::new()}; + println!("Number of consolidated talks: {}", talks_array.len()); @@ -252,7 +297,7 @@ fn main() { return talk_id_get_result; }) .skip(0) - .take(15) + .take(30) .for_each(|result| { let json = result.unwrap().json::().expect("Failed to deserialize response to JSON"); let talk_histories = &json["talk_histories"]; @@ -328,9 +373,9 @@ SEGUINDO OS CRITÉRIOS QUE VÃO ESTAR ABAIXO, AVALIE ATENDIMENTOS DE SUPORTE PRE 04 (USO DO PORTUGUÊS) - O AGENTE DEVE UTILIZAR CORRETAMENTE O PORTUGUÊS. LEMBRANDO QUE SOMOS UMA EMPRESA REGIONAL, UTILIZAMOS UMA LINGUAGEM MAIS INFORMAL. NÃO ESTÁ ERRADO SE O AGENTE UTILIZAR 'TU', 'TEU', 'TUA'. -05 (PACIÊNCIA E EDUCAÇÃO) - O AGENTE DEVE SER PACIENTE E EDUCADO, UTILIZANDO O USO DE AGRADECIMENTOS, SAUDAÇÕES, PEDIDOS DE DESCULPAS E LINGUAGEM RESPEITOSA, COMO POR EXEMPLO 'VOU VERIFICAR, AGUARDE UM MOMENTO POR GENTILEZA', 'DESCULPE, MAS NÃO TE COMPREENDI, PODERIA EXPLICAR DE NOVO?', 'OBRIGADO PELAS INFORMAÇÕES'. +05 (PACIÊNCIA E EDUCAÇÃO) - O AGENTE DEVE SER PACIENTE E EDUCADO, UTILIZANDO O USO DE AGRADECIMENTOS, SAUDAÇÕES, PEDIDOS DE DESCULPAS E LINGUAGEM RESPEITOSA, COMO POR EXEMPLO 'COMO POSSO TE AJUDAR?', 'PERFEITO', 'VOU VERIFICAR, AGUARDE UM MOMENTO POR GENTILEZA', 'DESCULPE, MAS NÃO TE COMPREENDI', 'PODERIA EXPLICAR DE NOVO?', 'OBRIGADO PELAS INFORMAÇÕES'. -06 (DISPONIBILIDADE) - O AGENTE DEVE SE COLOCAR À DISPOSIÇÃO DO CLIENTE, DEIXANDO CLARO QUE A EMPRESA ESTÁ SEMPRE DISPONÍVEL PARA AJUDAR. +06 (DISPONIBILIDADE) - O AGENTE DEVE SE COLOCAR À DISPOSIÇÃO DO CLIENTE, DEIXANDO CLARO QUE A EMPRESA ESTÁ SEMPRE DISPONÍVEL PARA AJUDAR ---------- As mensagens do chat estão estruturadas no formato JSON com os campos: @@ -345,6 +390,8 @@ Em cada categoria, atribua 0 quando o agente não tiver atendido o critétio e 1 A sua resposta deve ser uma apenas uma tabela CSV e nada mais, utilizando como separador o caracter ';' com as colunas: CATEGORIA;PONTOS;MOTIVO;EVIDENCIA onde cada linha contém a avaliação de um dos critérios acima. +Na saída CSV, na coluna categoria, utilize o nome correspondente ao invés do número + A seguir estão as mensagens do atendimento, em JSON, avalie e retorne apenas um CSV. ";