Allow for prompt caching to work by using baibot_conversation_start_time_utc instead of baibot_now_utc

This patch introduces a new `baibot_conversation_start_time_utc`
variable which indicates the time the conversation got started.

Using `baibot_now_utc` is still possible, but given that the current
time is a moving target, its use is in conflict with prompt caching.

Because the new `baibot_conversation_start_time_utc` prompt variable
is a more reasonable default, we're now using it in all sample configs.
This commit is contained in:
Slavi Pantaleev
2024-10-03 11:48:14 +03:00
parent db9422740c
commit 85e66406dc
25 changed files with 159 additions and 25 deletions

View File

@@ -234,6 +234,13 @@ pub fn convert_matrix_native_event_to_matrix_message(
text
};
let timestamp = chrono::DateTime::<chrono::Utc>::from(
matrix_native_event
.origin_server_ts()
.to_system_time()
.unwrap_or_else(std::time::SystemTime::now),
);
let mentioned_users = room_message
.mentions
.map(|m| m.user_ids.iter().map(|u| u.to_owned()).collect())
@@ -248,6 +255,7 @@ pub fn convert_matrix_native_event_to_matrix_message(
},
message_text: text,
mentioned_users,
timestamp,
})
}