v0.0.32: system bots config — persist across data wipes, welcome screen
Server: - --bots-config <path> loads JSON array of system bots on startup - Bots auto-created if missing, aliases restored on every start - Bot list stored in DB for welcome screen (system:bot_list key) - GET /v1/bot/list returns system bots (public, no auth) Welcome screen: - Web + TUI show available bots on first login - "Available bots: @helpbot — featherChat help, @codebot — Coding..." - Clickable in web (via address detection) Config: bots.example.json with 10 suggested bots Usage: warzone-server --enable-bots --bots-config bots.json Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,23 @@ pub async fn run_tui(
|
||||
message_id: None,
|
||||
timestamp: chrono::Local::now(),
|
||||
});
|
||||
|
||||
// Show system bots
|
||||
if let Ok(resp) = client.client.get(format!("{}/v1/bot/list", client.base_url)).send().await {
|
||||
if let Ok(data) = resp.json::<serde_json::Value>().await {
|
||||
if let Some(bots) = data.get("bots").and_then(|v| v.as_array()) {
|
||||
if !bots.is_empty() {
|
||||
app.add_message(types::ChatLine { sender: "system".into(), text: "Available bots:".into(), is_system: true, is_self: false, message_id: None, timestamp: chrono::Local::now() });
|
||||
for b in bots {
|
||||
let name = b.get("name").and_then(|v| v.as_str()).unwrap_or("?");
|
||||
let desc = b.get("description").and_then(|v| v.as_str()).unwrap_or("");
|
||||
app.add_message(types::ChatLine { sender: "system".into(), text: format!(" @{} — {}", name, desc), is_system: true, is_self: false, message_id: None, timestamp: chrono::Local::now() });
|
||||
}
|
||||
app.add_message(types::ChatLine { sender: "system".into(), text: "Message a bot: /peer @botname".into(), is_system: true, is_self: false, message_id: None, timestamp: chrono::Local::now() });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loop {
|
||||
|
||||
Reference in New Issue
Block a user