fix(topbar): show the live connected-agent count

The TopBar agent chip hardcoded `agent_count: 0`, so it always
painted the empty 'Agents & MCP' set-up affordance even after the
user connected a provider in Settings → Agents. It now reflects
the real count of connected providers (`agent_settings.connected`).

The chip's '{N} agent' label keyed `topbar.agentSingular`, which
was missing from every locale table — the chip rendered the raw
key. Added the key to all 15 locales.
This commit is contained in:
Kayshen-X 2026-05-22 11:40:19 +08:00
parent 9aa2c06c46
commit c8b5e7a73a
16 changed files with 21 additions and 1 deletions

View file

@ -75,10 +75,15 @@ impl TopBar {
.file_name_display
.clone()
.unwrap_or_else(|| translate(ui, "common.untitled").to_string());
// The chip reflects how many providers the user has
// connected in Settings → Agents: `0` paints the
// "Agents & MCP" set-up affordance, `≥ 1` the green-dot
// "N agent" status.
let agent_count = ui.agent_settings.connected.iter().filter(|&&c| c).count() as u32;
Self {
id: WidgetId::new(5000),
file_name,
agent_count: 0,
agent_count,
theme: theme_for(ui),
label_agents_and_mcp: translate(ui, "topbar.agentsAndMcp"),
label_agent_singular: translate(ui, "topbar.agentSingular"),

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "Ihre Änderungen gehen verloren, wenn Sie sie nicht speichern.",
"topbar.dontSave" => "Nicht speichern",
"topbar.agentsAndMcp" => "Agenten & MCP",
"topbar.agentSingular" => "Agent",
"topbar.setupAgentsMcp" => "Agenten & MCP einrichten",
"topbar.connected" => "verbunden",
"topbar.agentStatus" => "{{agents}} Agent{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "Your changes will be lost if you don't save them.",
"topbar.dontSave" => "Don't Save",
"topbar.agentsAndMcp" => "Agents & MCP",
"topbar.agentSingular" => "agent",
"topbar.setupAgentsMcp" => "Setup Agents & MCP",
"topbar.connected" => "connected",
"topbar.agentStatus" => "{{agents}} agent{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "Sus cambios se perderán si no los guarda.",
"topbar.dontSave" => "No guardar",
"topbar.agentsAndMcp" => "Agentes y MCP",
"topbar.agentSingular" => "agente",
"topbar.setupAgentsMcp" => "Configurar Agentes y MCP",
"topbar.connected" => "conectado",
"topbar.agentStatus" => "{{agents}} agente{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "Vos modifications seront perdues si vous ne les enregistrez pas.",
"topbar.dontSave" => "Ne pas enregistrer",
"topbar.agentsAndMcp" => "Agents & MCP",
"topbar.agentSingular" => "agent",
"topbar.setupAgentsMcp" => "Configurer Agents & MCP",
"topbar.connected" => "connecté",
"topbar.agentStatus" => "{{agents}} agent{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "यदि आप सहेजते नहीं हैं तो आपके परिवर्तन खो जाएंगे।",
"topbar.dontSave" => "सहेजें नहीं",
"topbar.agentsAndMcp" => "एजेंट और MCP",
"topbar.agentSingular" => "एजेंट",
"topbar.setupAgentsMcp" => "एजेंट और MCP सेटअप करें",
"topbar.connected" => "कनेक्टेड",
"topbar.agentStatus" => "{{agents}} एजेंट{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "Perubahan Anda akan hilang jika tidak disimpan.",
"topbar.dontSave" => "Jangan simpan",
"topbar.agentsAndMcp" => "Agent & MCP",
"topbar.agentSingular" => "agen",
"topbar.setupAgentsMcp" => "Pengaturan Agent & MCP",
"topbar.connected" => "terhubung",
"topbar.agentStatus" => "{{agents}} agent{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "保存しないと変更内容が失われます。",
"topbar.dontSave" => "保存しない",
"topbar.agentsAndMcp" => "Agents & MCP",
"topbar.agentSingular" => "エージェント",
"topbar.setupAgentsMcp" => "Agents & MCP を設定",
"topbar.connected" => "接続済み",
"topbar.agentStatus" => "{{agents}} Agent{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "저장하지 않으면 변경 사항이 손실됩니다.",
"topbar.dontSave" => "저장 안 함",
"topbar.agentsAndMcp" => "에이전트 & MCP",
"topbar.agentSingular" => "에이전트",
"topbar.setupAgentsMcp" => "에이전트 & MCP 설정",
"topbar.connected" => "연결됨",
"topbar.agentStatus" => "에이전트 {{agents}}개{{agentSuffix}} · MCP {{mcp}}개",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "Suas alterações serão perdidas se não forem salvas.",
"topbar.dontSave" => "Não salvar",
"topbar.agentsAndMcp" => "Agentes & MCP",
"topbar.agentSingular" => "agente",
"topbar.setupAgentsMcp" => "Configurar Agentes & MCP",
"topbar.connected" => "conectado",
"topbar.agentStatus" => "{{agents}} agente{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "Ваши изменения будут потеряны, если вы их не сохраните.",
"topbar.dontSave" => "Не сохранять",
"topbar.agentsAndMcp" => "Агенты и MCP",
"topbar.agentSingular" => "агент",
"topbar.setupAgentsMcp" => "Настройка агентов и MCP",
"topbar.connected" => "подключено",
"topbar.agentStatus" => "{{agents}} агент{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "การเปลี่ยนแปลงของคุณจะสูญหายหากไม่บันทึก",
"topbar.dontSave" => "ไม่บันทึก",
"topbar.agentsAndMcp" => "เอเจนต์และ MCP",
"topbar.agentSingular" => "เอเจนต์",
"topbar.setupAgentsMcp" => "ตั้งค่าเอเจนต์และ MCP",
"topbar.connected" => "เชื่อมต่อแล้ว",
"topbar.agentStatus" => "{{agents}} เอเจนต์{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "Kaydetmezseniz değişiklikleriniz kaybolacaktır.",
"topbar.dontSave" => "Kaydetme",
"topbar.agentsAndMcp" => "Ajanlar ve MCP",
"topbar.agentSingular" => "ajan",
"topbar.setupAgentsMcp" => "Ajanları ve MCP Kur",
"topbar.connected" => "bağlı",
"topbar.agentStatus" => "{{agents}} ajan{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "Các thay đổi của bạn sẽ bị mất nếu không lưu.",
"topbar.dontSave" => "Không lưu",
"topbar.agentsAndMcp" => "Agent & MCP",
"topbar.agentSingular" => "agent",
"topbar.setupAgentsMcp" => "Thiết lập Agent & MCP",
"topbar.connected" => "đã kết nối",
"topbar.agentStatus" => "{{agents}} agent{{agentSuffix}} · {{mcp}} MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "如果不保存,您的更改将会丢失。",
"topbar.dontSave" => "不保存",
"topbar.agentsAndMcp" => "Agents 与 MCP",
"topbar.agentSingular" => "个 Agent",
"topbar.setupAgentsMcp" => "设置 Agents 与 MCP",
"topbar.connected" => "已连接",
"topbar.agentStatus" => "{{agents}} 个 Agent{{agentSuffix}} · {{mcp}} 个 MCP",

View file

@ -55,6 +55,7 @@ pub fn lookup(key: &str) -> Option<&'static str> {
"topbar.closeConfirmDetail" => "如果不儲存,您的變更將會遺失。",
"topbar.dontSave" => "不儲存",
"topbar.agentsAndMcp" => "Agents 與 MCP",
"topbar.agentSingular" => "個 Agent",
"topbar.setupAgentsMcp" => "設定 Agents 與 MCP",
"topbar.connected" => "已連線",
"topbar.agentStatus" => "{{agents}} 個 Agent{{agentSuffix}} · {{mcp}} 個 MCP",