feat(app): background collection frame for sites, search words and RSS feeds
Targets (none by default), interval and keep days on a new 백그라운드 수집 screen with the results; the worker collects on its own thread through the web search's address check and writes only to the data folder's collect/ (logs carry target names and counts). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ pub enum Screen {
|
||||
Memory,
|
||||
Model,
|
||||
Features,
|
||||
Collect,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize)]
|
||||
@@ -45,6 +46,8 @@ pub enum Kind {
|
||||
ChatChannels,
|
||||
/// The MCP servers (their own rules are checked by `parse_settings`; values are secrets).
|
||||
McpServers,
|
||||
/// The background collection targets (their own rules are checked by `parse_settings`).
|
||||
CollectTargets,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, serde::Serialize)]
|
||||
@@ -119,7 +122,11 @@ pub fn fields() -> Vec<Field> {
|
||||
f("features.weather", Features, Bool, json!(true), "날씨"),
|
||||
f("features.webSearch", Features, Bool, json!(true), "웹 검색"),
|
||||
f("features.meals", Features, Bool, json!(true), "식단 기록"),
|
||||
f("features.collect", Features, Bool, json!(true), "백그라운드 수집"),
|
||||
f("mcpServers", Features, McpServers, json!([]), "MCP 서버"),
|
||||
// Background collection (admin.spec.md, "Background collection"): no targets by default.
|
||||
f("collect.targets", Collect, CollectTargets, json!([]), "수집 대상"),
|
||||
f("collect.keepDays", Collect, Int { min: 1, max: 365 }, json!(30), "보관 기간(일)"),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -209,7 +216,7 @@ fn check(field: &Field, v: &Value) -> Result<(), String> {
|
||||
Kind::IdList => v.as_array().is_some_and(|a| a.iter().all(is_id)),
|
||||
Kind::IdNumberMap => v.as_object().is_some_and(|m| m.iter()
|
||||
.all(|(k, n)| is_id(&Value::String(k.clone())) && n.as_i64().is_some())),
|
||||
Kind::ChatChannels | Kind::McpServers => v.is_array(),
|
||||
Kind::ChatChannels | Kind::McpServers | Kind::CollectTargets => v.is_array(),
|
||||
};
|
||||
if ok { Ok(()) } else { Err(format!("{} has a value it cannot take", field.path)) }
|
||||
}
|
||||
@@ -319,6 +326,7 @@ mod tests {
|
||||
(json!({"discord.commandName": "Big Name"}), "discord.commandName"),
|
||||
// A chat channel without a valid ID.
|
||||
(json!({"chatChannels": [{"id": "1"}]}), "chatChannels[0].id"),
|
||||
(json!({"collect.targets": [{"name": "nul", "kind": "rss", "value": "https://a"}]}), "collect.targets[0].name"),
|
||||
] {
|
||||
let e = apply(&p, &changes(c.clone()).into_iter().chain([("call.earcon".into(), json!(false))]).collect())
|
||||
.unwrap_err();
|
||||
|
||||
Reference in New Issue
Block a user