feat(app): answer registered chat channels in chat

- chatChannels[].answer: wakeWord (default) or everything. Chat uses
  call.chatWakeWords (else the voice wake words) with the shared
  designated-people switches.
- The brain's answer (reply via chat, not spoken) is posted as a Discord
  reply to the message, pinging nobody; failed or empty answers post
  nothing. Bots, channels with sending off and stops are not answered.
- Chat runs beside the voice conversation and never takes its turn.
- Core: send_chat_reply, chat_answer and the ReplyText event; the worker
  client's reply takes via.
- Specs (conversation, discord core) and the roadmap updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-11 22:36:43 +09:00
parent de35573e5f
commit a70ccda37e
11 changed files with 284 additions and 16 deletions

View File

@@ -30,6 +30,9 @@ pub struct ChatChannelSettings {
pub delete: bool,
/// The assistant may pin and unpin messages here. Off by default.
pub pin: bool,
/// Answer every message here (`answer: "everything"`), not only those calling a wake word (`"wakeWord"`,
/// the default; conversation.spec.md).
pub answer_all: bool,
}
#[derive(Debug, Clone, PartialEq, Eq)]
@@ -349,6 +352,11 @@ pub fn parse_settings(raw: &Value) -> Result<Settings, SettingsError> {
react: get_bool(Some(m), "react", &path, true)?,
delete: get_bool(Some(m), "delete", &path, false)?,
pin: get_bool(Some(m), "pin", &path, false)?,
answer_all: match get_str(Some(m), "answer", &path, "wakeWord")?.as_str() {
"wakeWord" => false,
"everything" => true,
_ => return err(format!("{path}.answer must be wakeWord or everything")),
},
});
}
@@ -435,7 +443,7 @@ mod tests {
assert_eq!(s.voice.stt.get("end_silence_ms"), Some(&json!(250)));
assert_eq!(s.chat_channels, vec![ChatChannelSettings { id: IDN, name: "일정".into(),
description: "일정 올리는 곳".into(), read: true, send: false, edit: true, react: true, delete: false,
pin: false }]);
pin: false, answer_all: false }]);
assert_eq!(s.voice_worker.args, vec!["--melo-python", "/m/python"]);
assert_eq!(s.voice_worker.cwd, PathBuf::from("/repo/src"));
}
@@ -453,6 +461,7 @@ mod tests {
(json!({"chatChannels": [{"id": ID}, {"id": ID}]}), "twice"),
(json!({"chatChannels": [{"id": "1"}]}), "chatChannels[0].id"),
(json!({"chatChannels": {}}), "chatChannels"),
(json!({"chatChannels": [{"id": ID, "answer": "sometimes"}]}), "chatChannels[0].answer"),
(json!({"voice": []}), "voice"),
(json!([]), "object"),
];
@@ -483,6 +492,8 @@ mod tests {
assert_eq!(s.response.collect, Duration::from_millis(500));
assert_eq!(s.response.settle, Duration::ZERO);
assert_eq!(s.response.priorities.get(&IDN), Some(&2));
let s = parse_settings(&json!({"chatChannels": [{"id": ID, "answer": "everything"}]})).unwrap();
assert!(s.chat_channels[0].answer_all);
let cases = [
(json!({"call": {"similarity": 0.9}}), "call.similarity"),