fix(app): the activity log keeps ids and known words only and prunes on each new day
A chat action's channel, message and asker are recorded only when they are ids (else '(잘못된 ID)'), an unknown action as chat.other, and a failure as a fixed note, so text the model put in those fields never reaches the log. Old day files are also deleted on the first record of each new day. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -891,16 +891,16 @@ async fn worker_task(core: std::sync::Weak<Inner>, mut rx: mpsc::UnboundedReceiv
|
||||
debug_log!("chat", "chat {} {} failed: {e}", a.action, a.id);
|
||||
}
|
||||
if let Some(activity) = core.inner.activity.get() {
|
||||
let target = match &a.message_id {
|
||||
Some(m) => format!("채널 {} 메시지 {m}", a.channel),
|
||||
None => format!("채널 {}", a.channel),
|
||||
};
|
||||
// Ids and known words only: the model may put any text in these fields,
|
||||
// and errors may quote it.
|
||||
use crate::activity::{chat_kind, chat_target, id_or_mark, CHAT_FAILED};
|
||||
let target = chat_target(&a.channel, a.message_id.as_deref());
|
||||
let by = a.user.as_ref().map(|u| match u.parse() {
|
||||
Ok(id) => format!("{u} {}", name_of(&core.inner, id)),
|
||||
Err(_) => u.clone(),
|
||||
Ok(id) if id_or_mark(u) == *u => format!("{u} {}", name_of(&core.inner, id)),
|
||||
_ => id_or_mark(u),
|
||||
});
|
||||
activity.record(&format!("chat.{}", a.action), &target, by, result.is_ok(),
|
||||
result.as_ref().err().cloned());
|
||||
activity.record(&chat_kind(&a.action), &target, by, result.is_ok(),
|
||||
result.is_err().then(|| CHAT_FAILED.to_owned()));
|
||||
}
|
||||
core.inner.worker.chat_action_result(&a.id, result);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user