forked from jelson.rodrigues/piperun-bot
chore: update system prompt
This commit is contained in:
71
src/main.rs
71
src/main.rs
@@ -166,8 +166,8 @@ fn main() {
|
|||||||
let formatted_day_before = day_before_at_midnight.format("%Y-%m-%d").to_string();
|
let formatted_day_before = day_before_at_midnight.format("%Y-%m-%d").to_string();
|
||||||
|
|
||||||
// Create a folder named with the day_before
|
// Create a folder named with the day_before
|
||||||
if !std::fs::exists(format!("{formatted_day_before}")).unwrap() {
|
if !std::fs::exists(format!("./evaluations/{formatted_day_before}")).unwrap() {
|
||||||
std::fs::create_dir(format!("{formatted_day_before}")).expect("Failed to create directory")
|
std::fs::create_dir(format!("./evaluations/{formatted_day_before}")).expect("Failed to create directory")
|
||||||
}
|
}
|
||||||
|
|
||||||
let start_of_talk_code: String = "talk_start".to_string();
|
let start_of_talk_code: String = "talk_start".to_string();
|
||||||
@@ -175,17 +175,21 @@ fn main() {
|
|||||||
|
|
||||||
// API V2
|
// API V2
|
||||||
let report_type = "consolidated".to_string();
|
let report_type = "consolidated".to_string();
|
||||||
|
let page = "1".to_string();
|
||||||
|
let per_page = "30".to_string();
|
||||||
let talks_request = client
|
let talks_request = client
|
||||||
.get(format!("https://{}/api/v2/reports/talks", PIPERUN_API_URL))
|
.get(format!("https://{}/api/v2/reports/talks", PIPERUN_API_URL))
|
||||||
.bearer_auth(&access_token)
|
.bearer_auth(&access_token)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.header("Accept", "application/json")
|
.header("Accept", "application/json")
|
||||||
.query(&[
|
.query(&[
|
||||||
("report_type", report_type),
|
("page", page.clone()),
|
||||||
("start_date", formatted_day_before_at_midnight),
|
("perPage", per_page.clone()),
|
||||||
("end_date", formatted_day_before_at_23_59_59),
|
("report_type", report_type.clone()),
|
||||||
("date_range_type", start_of_talk_code),
|
("start_date", formatted_day_before_at_midnight.clone()),
|
||||||
("queue_id[]", support_queue_id),
|
("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:?}");
|
println!("Sending request for consolidated talks... {talks_request:?}");
|
||||||
@@ -194,7 +198,6 @@ fn main() {
|
|||||||
Ok(resp) => {
|
Ok(resp) => {
|
||||||
if resp.status().is_success() {
|
if resp.status().is_success() {
|
||||||
let json: serde_json::Value = resp.json().unwrap();
|
let json: serde_json::Value = resp.json().unwrap();
|
||||||
// println!("Consolidated talks response: {:?}", json);
|
|
||||||
|
|
||||||
json
|
json
|
||||||
} else {
|
} else {
|
||||||
@@ -215,7 +218,49 @@ fn main() {
|
|||||||
.as_array()
|
.as_array()
|
||||||
.expect("Failed to parse talks response 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());
|
println!("Number of consolidated talks: {}", talks_array.len());
|
||||||
|
|
||||||
@@ -252,7 +297,7 @@ fn main() {
|
|||||||
return talk_id_get_result;
|
return talk_id_get_result;
|
||||||
})
|
})
|
||||||
.skip(0)
|
.skip(0)
|
||||||
.take(15)
|
.take(30)
|
||||||
.for_each(|result| {
|
.for_each(|result| {
|
||||||
let json = result.unwrap().json::<serde_json::Value>().expect("Failed to deserialize response to JSON");
|
let json = result.unwrap().json::<serde_json::Value>().expect("Failed to deserialize response to JSON");
|
||||||
let talk_histories = &json["talk_histories"];
|
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'.
|
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:
|
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.
|
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.
|
A seguir estão as mensagens do atendimento, em JSON, avalie e retorne apenas um CSV.
|
||||||
|
|
||||||
";
|
";
|
||||||
|
|||||||
Reference in New Issue
Block a user