Adição de filtro de type=out no .txt

This commit is contained in:
2026-05-15 10:56:20 -03:00
parent b34e5d825a
commit 8be8caf6fb

View File

@@ -232,7 +232,6 @@ fn main() -> anyhow::Result<()> {
)) ))
.expect("Failed to create response_time.csv"); .expect("Failed to create response_time.csv");
} }
*/ */
// Read system prompt // Read system prompt
@@ -507,6 +506,14 @@ fn main() -> anyhow::Result<()> {
.expect("Wrong message type received from talk histories") .expect("Wrong message type received from talk histories")
.iter() .iter()
.rev() .rev()
//filtro para escrever somente as mensagens out no .txt
.filter(|(message_object)| {
let message_type = message_object["type"]
.as_str()
.expect("Failed to decode message as string");
message_type == "out".to_string()
})
//fim do filtro
.map(|message_object| { .map(|message_object| {
let new_json_filtered = format!( let new_json_filtered = format!(
"{{ "{{
@@ -535,7 +542,6 @@ fn main() -> anyhow::Result<()> {
serde_json::json!({ serde_json::json!({
"model": OLLAMA_AI_MODEL, "model": OLLAMA_AI_MODEL,
"prompt": format!("{prompt} \n{talk}"), "prompt": format!("{prompt} \n{talk}"),
// "options": serde_json::json!({"temperature": 0.1}),
"stream": false, "stream": false,
}) })
.to_string(), .to_string(),