Adição de filtro de type=out no .txt
This commit is contained in:
14
src/main.rs
14
src/main.rs
@@ -411,8 +411,6 @@ fn main() -> anyhow::Result<()> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Find first agent message sent after the last bot message
|
// Find first agent message sent after the last bot message
|
||||||
// let (pos, transfer_message) =
|
|
||||||
// bot_transfer_message.expect("Failed to get the transfer bot message position");
|
|
||||||
|
|
||||||
let (pos, transfer_message) = match bot_transfer_message {
|
let (pos, transfer_message) = match bot_transfer_message {
|
||||||
Some((pos, msg)) => (pos, msg),
|
Some((pos, msg)) => (pos, msg),
|
||||||
@@ -512,6 +510,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!(
|
||||||
"{{
|
"{{
|
||||||
@@ -519,13 +525,12 @@ fn main() -> anyhow::Result<()> {
|
|||||||
sent_at: {},
|
sent_at: {},
|
||||||
type: {},
|
type: {},
|
||||||
user_name: {}
|
user_name: {}
|
||||||
}}",
|
}}",
|
||||||
message_object["message"],
|
message_object["message"],
|
||||||
message_object["sent_at"],
|
message_object["sent_at"],
|
||||||
message_object["type"],
|
message_object["type"],
|
||||||
message_object["user"]["name"]
|
message_object["user"]["name"]
|
||||||
);
|
);
|
||||||
// println!("{}", new_json_filtered);
|
|
||||||
new_json_filtered
|
new_json_filtered
|
||||||
})
|
})
|
||||||
.reduce(|acc, e| format!("{acc}\n{e}"))
|
.reduce(|acc, e| format!("{acc}\n{e}"))
|
||||||
@@ -541,7 +546,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(),
|
||||||
|
|||||||
Reference in New Issue
Block a user