A step on a skill or a memory says which one

The phone showed a bare 「刪除技能」 when 新 Bot deleted the test skill; save/use/delete skill,
remember and forget now carry the name or the fact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uirha2RVfSYmrhqNnqx9Z4
This commit is contained in:
王性驊 2026-11-07 00:36:24 +08:00
parent 19f8257e48
commit e0a1545e0e
1 changed files with 12 additions and 0 deletions

View File

@ -128,6 +128,10 @@ pub fn describe(name: &str, args: &str) -> String {
"delete_routine" | "run_routine_now" => format!("#{}", v.get("id").and_then(Value::as_u64).unwrap_or(0)), "delete_routine" | "run_routine_now" => format!("#{}", v.get("id").and_then(Value::as_u64).unwrap_or(0)),
"message_bot" => format!("給 {}:{}", s("bot"), s("text").chars().take(40).collect::<String>()), "message_bot" => format!("給 {}:{}", s("bot"), s("text").chars().take(40).collect::<String>()),
"create_bot" | "update_bot" => s("name").to_string() + &s("bot"), "create_bot" | "update_bot" => s("name").to_string() + &s("bot"),
// Which skill (the phone showed a bare 「刪除技能」), and which memory.
"save_skill" | "use_skill" | "delete_skill" => s("name"),
"remember" => s("fact").chars().take(40).collect(),
"forget" => s("what"),
n if crate::pages::NAMES.contains(&n) => crate::pages::describe(n, &v), n if crate::pages::NAMES.contains(&n) => crate::pages::describe(n, &v),
_ => String::new(), _ => String::new(),
} }
@ -594,6 +598,14 @@ pub fn apply(state: &mut State, bot_id: u64, name: &str, args: &str) -> Outcome
mod tests { mod tests {
use super::*; use super::*;
#[test]
fn a_step_on_skills_and_memories_names_which() {
assert_eq!(describe("delete_skill", r#"{"name":"本地活動報名"}"#), "本地活動報名");
assert_eq!(describe("use_skill", r#"{"name":"Threads 發文"}"#), "Threads 發文");
assert_eq!(describe("remember", r#"{"fact":"之後都用自己的電腦"}"#), "之後都用自己的電腦");
assert_eq!(describe("forget", r#"{"what":"2"}"#), "2");
}
#[test] #[test]
fn chat_sets_up_and_manages_routines() { fn chat_sets_up_and_manages_routines() {
let mut st = State::samples(); let mut st = State::samples();