From 7fbdb5e79d338706ad64fb9632a1ae8e8f272814 Mon Sep 17 00:00:00 2001 From: Yingjie He Date: Tue, 6 May 2025 10:02:48 -0700 Subject: [PATCH] fix: use less strict timestamp in system prompt (#2434) --- crates/goose/src/agents/prompt_manager.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/goose/src/agents/prompt_manager.rs b/crates/goose/src/agents/prompt_manager.rs index 1a257ab8..f464af7d 100644 --- a/crates/goose/src/agents/prompt_manager.rs +++ b/crates/goose/src/agents/prompt_manager.rs @@ -9,6 +9,7 @@ use crate::{config::Config, prompt_template}; pub struct PromptManager { system_prompt_override: Option, system_prompt_extras: Vec, + 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(