mirror of
https://github.com/block/buzz.git
synced 2026-10-28 04:51:40 +00:00
fix(buzz-agent): preserve prompt date context
Signed-off-by: Jimmy <1fe240cd1a8cf775f6f3060f115e5a303181f3abf28ad4cb0c2515f4a02b36a8@meshllm.communities.buzz.xyz>
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -979,6 +979,7 @@ dependencies = [
|
||||
"axum",
|
||||
"base64 0.22.1",
|
||||
"buzz-model-catalog",
|
||||
"chrono",
|
||||
"dirs",
|
||||
"fs2",
|
||||
"futures",
|
||||
|
||||
@@ -62,6 +62,7 @@ serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
serde_yaml = { workspace = true }
|
||||
reqwest = { workspace = true, features = ["json", "rustls", "form"] }
|
||||
chrono = { workspace = true }
|
||||
rmcp = { version = "3", default-features = false, features = ["client", "transport-child-process"] }
|
||||
arc-swap = "1"
|
||||
getrandom = "0.4"
|
||||
|
||||
@@ -73,7 +73,7 @@ impl SessionPrompt {
|
||||
}
|
||||
state.composer.render(
|
||||
&PromptContext {
|
||||
current_date_time: String::new(),
|
||||
current_date_time: chrono::Utc::now().format("%Y-%m-%d %H:00 %:z").to_string(),
|
||||
goose_mode: self.mode,
|
||||
variables: Default::default(),
|
||||
},
|
||||
@@ -119,6 +119,20 @@ mod tests {
|
||||
assert!(built.contains("Always ship the sprocket first."));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn override_renders_current_date_time() {
|
||||
let prompt = SessionPrompt::new(GooseMode::Auto);
|
||||
prompt
|
||||
.set_override("It is currently {{ current_date_time }}".to_string())
|
||||
.await;
|
||||
let built = prompt.build(Path::new(".")).await.unwrap();
|
||||
assert!(built.starts_with("It is currently 20"), "{built:?}");
|
||||
assert!(
|
||||
!built.contains("{{"),
|
||||
"template variable was not rendered: {built:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn instructions_are_loaded_once() {
|
||||
let root = tempfile::tempdir().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user