Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

feat(ui): auto-restart vibe service on platform settings apply

cyh67e38ddb52f5
diff --git a/ui/src/components/settings/SettingsPlatformsPage.tsx b/ui/src/components/settings/SettingsPlatformsPage.tsx
index 1108ec71e..97675d96c 100644
--- a/ui/src/components/settings/SettingsPlatformsPage.tsx
+++ b/ui/src/components/settings/SettingsPlatformsPage.tsx
@@ -1,9 +1,10 @@
import React, { useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import clsx from 'clsx';
-import { Check, ChevronUp, Pencil, RefreshCw } from 'lucide-react';
+import { Check, ChevronUp, Loader2, Pencil, RefreshCw, RotateCw } from 'lucide-react';
import { useApi } from '@/context/ApiContext';
+import { useStatus } from '@/context/StatusContext';
import { useToast } from '@/context/ToastContext';
import { getEnabledPlatforms, getPlatformCatalog, getPrimaryPlatform, platformHasCredentials } from '@/lib/platforms';
import { PlatformIcon } from '@/components/visual';
@@ -28,12 +29,14 @@ type ExpandedKey = string | null; // 'enabled' | platform id | null
export const SettingsPlatformsPage: React.FC = () => {
const { t } = useTranslation();
const api = useApi();
+ const { control } = useStatus();
const { showToast } = useToast();
const [config, setConfig] = useState<any>(null);
const [expanded, setExpanded] = useState<ExpandedKey>(null);
const [draftEnabled, setDraftEnabled] = useState<string[]>([]);
const [draftPrimary, setDraftPrimary] = useState<string>('');
const [savingEnabled, setSavingEnabled] = useState(false);
+ const [restartPhase, setRestartPhase] = useState<'idle' | 'saving' | 'restarting'>('idle');
useEffect(() => {
api.getConfig().then(setConfig).catch(() => {});
@@ -53,11 +56,26 @@ export const SettingsPlatformsPage: React.FC = () => {
const closeAll = () => setExpanded(null);
+ const saveAndRestart = async (nextData: any) => {
+ setRestartPhase('saving');
+ try {
+ await api.saveConfig(nextData);
+ setConfig((prev: any) => ({ ...(prev || {}), ...nextData }));
+ closeAll();
+ setRestartPhase('restarting');
+ try {
+ await control('restart');
+ showToast(t('platform.restartedSuccess'), 'success');
+ } catch {
+ showToast(t('platform.restartFailed'), 'error');
+ }
+ } finally {
+ setRestartPhase('idle');
+ }
+ };
+
const handleApplyPlatform = async (nextData: any) => {
- await api.saveConfig(nextData);
- setConfig((prev: any) => ({ ...(prev || {}), ...nextData }));
- showToast(t('common.saved'), 'success');
- closeAll();
+ await saveAndRestart(nextData);
};
const toggleDraftPlatform = (id: string) => {
@@ -83,10 +101,7 @@ export const SettingsPlatformsPage: React.FC = () => {
};
setSavingEnabled(true);
try {
- await api.saveConfig(nextData);
- setConfig((prev: any) => ({ ...(prev || {}), ...nextData }));
- showToast(t('common.saved'), 'success');
- closeAll();
+ await saveAndRestart(nextData);
} finally {
setSavingEnabled(false);
}
@@ -111,6 +126,27 @@ export const SettingsPlatformsPage: React.FC = () => {
subtitle={t('settings.platformsSubtitle')}
>
<div className="mx-auto flex w-full max-w-[920px] flex-col gap-3">
+ {restartPhase !== 'idle' && (
+ <div
+ role="status"
+ aria-live="polite"
+ className="sticky top-2 z-10 flex items-center gap-3 rounded-xl border border-cyan/35 bg-cyan/[0.08] px-4 py-3 shadow-[0_8px_24px_-8px_rgba(0,212,255,0.35)]"
+ >
+ {restartPhase === 'saving' ? (
+ <Loader2 size={16} className="shrink-0 animate-spin text-cyan" />
+ ) : (
+ <RotateCw size={16} className="shrink-0 animate-spin text-cyan" strokeWidth={2.25} />
+ )}
+ <div className="min-w-0 flex-1">
+ <div className="text-[13px] font-semibold text-foreground">
+ {restartPhase === 'saving' ? t('platform.applyingConfig') : t('platform.restartingService')}
+ </div>
+ <div className="mt-0.5 text-[11px] text-muted">
+ {restartPhase === 'saving' ? t('common.saving') : t('dashboard.restarting')}
+ </div>
+ </div>
+ </div>
+ )}
{/* Enabled platforms card */}
<CollapseCard
expanded={expanded === 'enabled'}
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index bfda355c6..c53404f31 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -40,6 +40,7 @@
"manageChannels": "Manage groups",
"viewLogs": "View logs",
"saveAndRestart": "Save & Restart",
+ "close": "Close",
"copyFailed": "Copy failed, please copy it manually",
"themeSystem": "System theme",
"themeLight": "Light theme",
@@ -195,6 +196,10 @@
"selectedSummary": "{{count}} selected",
"apply": "Apply",
"applyHint": "Apply updates to the credential tabs below, disabled platforms keep saved tokens.",
+ "applyingConfig": "Applying configuration...",
+ "restartingService": "Restarting service to apply changes...",
+ "restartedSuccess": "Configuration applied and service restarted",
+ "restartFailed": "Configuration saved, but service restart failed",
"credentialSetupTitle": "{{platform}} workspace setup",
"credentialSetupSubtitle": "Configure the selected platform directly here, then validate credentials before enabling groups.",
"stepCreateApp": "Create platform app",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 5a37d44d1..21c11b5fe 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -40,6 +40,7 @@
"manageChannels": "管理群组",
"viewLogs": "查看日志",
"saveAndRestart": "保存并重启",
+ "close": "关闭",
"copyFailed": "复制失败,请手动复制",
"themeSystem": "跟随系统主题",
"themeLight": "浅色主题",
@@ -195,6 +196,10 @@
"selectedSummary": "已选择 {{count}} 个",
"apply": "应用",
"applyHint": "应用下方凭证标签的更新;未启用平台仍会保留已保存凭证。",
+ "applyingConfig": "正在应用配置...",
+ "restartingService": "正在重启服务以使配置生效...",
+ "restartedSuccess": "配置已应用,服务已重启",
+ "restartFailed": "配置已保存,但服务重启失败",
"credentialSetupTitle": "{{platform}} 工作区设置",
"credentialSetupSubtitle": "在这里直接配置选中平台,并在启用群组前验证凭证。",
"stepCreateApp": "创建平台应用",