fix: use less strict timestamp in system prompt (#2434)

This commit is contained in:
Yingjie He
2025-05-06 10:02:48 -07:00
committed by GitHub
parent c6986b7099
commit 7fbdb5e79d

View File

@@ -9,6 +9,7 @@ use crate::{config::Config, prompt_template};
pub struct PromptManager {
system_prompt_override: Option<String>,
system_prompt_extras: Vec<String>,
current_date_timestamp: String,
}
impl Default for PromptManager {
@@ -22,6 +23,8 @@ impl PromptManager {
PromptManager {
system_prompt_override: None,
system_prompt_extras: Vec::new(),
// Use the fixed current date time so that prompt cache can be used.
current_date_timestamp: Utc::now().format("%Y-%m-%d %H:%M:%S").to_string(),
}
}
@@ -79,8 +82,10 @@ impl PromptManager {
context.insert("extensions", serde_json::to_value(extensions_info).unwrap());
let current_date_time = Utc::now().format("%Y-%m-%d %H:%M:%S").to_string();
context.insert("current_date_time", Value::String(current_date_time));
context.insert(
"current_date_time",
Value::String(self.current_date_timestamp.clone()),
);
// Add the suggestion about disabling extensions if flag is true
context.insert(