Skip to content

Commit e2459d4

Browse files
authored
Merge pull request #5 from nikomatsakis/upgrade-elizacp
upgrade to latest version of dependencies
2 parents 56f51ac + 122f115 commit e2459d4

File tree

4 files changed

+23
-55
lines changed

4 files changed

+23
-55
lines changed

Cargo.lock

Lines changed: 14 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ resolver = "2"
99

1010
[workspace.dependencies]
1111
# Core async runtime
12-
tokio = { version = "1.0", features = ["full"] }
12+
tokio = { version = "1.48", features = ["full"] }
1313
tokio-util = { version = "0.7", features = ["compat"] }
1414

1515
# Protocol
@@ -21,11 +21,11 @@ serde_json = "1.0"
2121
schemars = { version = "1.0", features = ["derive"] }
2222

2323
# UUID generation
24-
uuid = { version = "1.0", features = ["v4"] }
24+
uuid = { version = "1.18", features = ["v4"] }
2525

2626
# Error handling
2727
anyhow = "1.0"
28-
thiserror = "1.0"
28+
thiserror = "2.0"
2929

3030
# Logging
3131
tracing = "0.1"

src/elizacp/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ agent-client-protocol-schema.workspace = true
2020
anyhow.workspace = true
2121
clap.workspace = true
2222
futures.workspace = true
23-
rand = "0.8"
24-
regex = "1.10"
23+
rand = "0.9"
24+
regex = "1.12"
2525
serde.workspace = true
2626
serde_json.workspace = true
2727
tokio.workspace = true

src/elizacp/src/eliza.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ impl Eliza {
243243
for pattern in &sorted_patterns {
244244
if let Some(captures) = pattern.pattern.captures(input) {
245245
// Choose a response using the seeded RNG
246-
let response_index = self.rng.gen_range(0..pattern.responses.len());
246+
let response_index = self.rng.random_range(0..pattern.responses.len());
247247
let response_template = &pattern.responses[response_index];
248248

249249
// Fill in captures with reflection
@@ -280,7 +280,7 @@ mod tests {
280280
let mut eliza = Eliza::new();
281281

282282
let response = eliza.respond("Hello");
283-
expect![[r#"Hi there. What brings you here today?"#]].assert_eq(&response);
283+
expect!["Hello. How are you feeling today?"].assert_eq(&response);
284284

285285
let response = eliza.respond("I am sad");
286286
expect!["Do you believe it is normal to be sad?"].assert_eq(&response);
@@ -303,7 +303,7 @@ mod tests {
303303

304304
// "sorry" should match high priority pattern
305305
let response = eliza.respond("I am sorry");
306-
expect![[r#"Apologies are not necessary."#]].assert_eq(&response);
306+
expect!["Please don't apologize."].assert_eq(&response);
307307
}
308308

309309
#[test]
@@ -312,7 +312,7 @@ mod tests {
312312

313313
// Trailing punctuation should be excluded from captures
314314
let response = eliza.respond("I feel sad.");
315-
expect![[r#"What makes you feel sad?"#]].assert_eq(&response);
315+
expect!["Do you often feel sad?"].assert_eq(&response);
316316
}
317317

318318
#[test]

0 commit comments

Comments
 (0)