fix: use less strict timestamp in system prompt (#2434)
This commit is contained in:
@@ -9,6 +9,7 @@ use crate::{config::Config, prompt_template};
|
|||||||
pub struct PromptManager {
|
pub struct PromptManager {
|
||||||
system_prompt_override: Option<String>,
|
system_prompt_override: Option<String>,
|
||||||
system_prompt_extras: Vec<String>,
|
system_prompt_extras: Vec<String>,
|
||||||
|
current_date_timestamp: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PromptManager {
|
impl Default for PromptManager {
|
||||||
@@ -22,6 +23,8 @@ impl PromptManager {
|
|||||||
PromptManager {
|
PromptManager {
|
||||||
system_prompt_override: None,
|
system_prompt_override: None,
|
||||||
system_prompt_extras: Vec::new(),
|
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());
|
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(
|
||||||
context.insert("current_date_time", Value::String(current_date_time));
|
"current_date_time",
|
||||||
|
Value::String(self.current_date_timestamp.clone()),
|
||||||
|
);
|
||||||
|
|
||||||
// Add the suggestion about disabling extensions if flag is true
|
// Add the suggestion about disabling extensions if flag is true
|
||||||
context.insert(
|
context.insert(
|
||||||
|
|||||||
Reference in New Issue
Block a user