feat(browser-connection): add sidebar connection status and localization support
- Implemented a toggle in the settings to show the browser connection status in the sidebar. - Updated the menu component to display the connection status for the browser connection tool. - Added localization strings for the sidebar status in English, Japanese, Korean, Russian, and Chinese. - Enhanced the UI store to manage the visibility of the sidebar browser status. This commit improves user experience by providing real-time feedback on the browser connection status directly in the sidebar.main
parent
2e801677a0
commit
e6e41ed301
|
|
@ -97,9 +97,14 @@
|
|||
:title="t('organization.settings.pendingJoinRequestsBadge')">{{
|
||||
orgStore.totalPendingJoinRequestCount }}</span>
|
||||
<span v-if="item.path === 'toolbox' && toolboxPreview.length" class="menu-toolbox-stack"
|
||||
:title="toolboxPreview.map((tool) => t(tool.title)).join(' · ')">
|
||||
:title="toolboxPreview.map((tool) => tool.key === 'browserconnection' && browserStackStatus
|
||||
? `${t(tool.title)} (${t(`localBrowser.${browserStackStatus}`)})` : t(tool.title)).join(' · ')">
|
||||
<span v-for="tool in toolboxPreview" :key="tool.key" class="menu-toolbox-stack__item">
|
||||
<BrowserIcon v-if="tool.key === 'browserconnection'" width="12" height="12" />
|
||||
<template v-if="tool.key === 'browserconnection'">
|
||||
<BrowserIcon width="12" height="12" />
|
||||
<i v-if="browserStackStatus" class="menu-toolbox-stack__status"
|
||||
:class="`is-${browserStackStatus}`" aria-hidden="true" />
|
||||
</template>
|
||||
<t-icon v-else :name="tool.icon" size="12px" />
|
||||
</span>
|
||||
</span>
|
||||
|
|
@ -264,6 +269,7 @@ import { useAuthStore } from '@/stores/auth';
|
|||
import { useDeploymentCapabilitiesStore } from '@/stores/deploymentCapabilities';
|
||||
import { TOOLBOX_ITEMS, canAccessToolboxSection } from '@/config/toolbox';
|
||||
import BrowserIcon from '@/components/icons/BrowserIcon.vue';
|
||||
import { useBrowserConnectionStore } from '@/stores/browserConnection';
|
||||
import { useOrganizationStore } from '@/stores/organization';
|
||||
import { useUIStore } from '@/stores/ui';
|
||||
import { useCommandPaletteStore } from '@/stores/commandPalette';
|
||||
|
|
@ -315,6 +321,15 @@ const toolboxPreview = computed(() => TOOLBOX_ITEMS.filter((item) => canAccessTo
|
|||
})));
|
||||
const orgStore = useOrganizationStore();
|
||||
const uiStore = useUIStore();
|
||||
const browserConnection = useBrowserConnectionStore();
|
||||
const browserStackStatus = computed(() => {
|
||||
if (!uiStore.sidebarBrowserStatus) return '';
|
||||
if (!browserConnection.loaded || !browserConnection.enabled || !browserConnection.device) return '';
|
||||
return browserConnection.connected ? 'connected' : 'offline';
|
||||
});
|
||||
watch(() => uiStore.sidebarBrowserStatus && toolboxPreview.value.some((tool) => tool.key === 'browserconnection'), (visible) => {
|
||||
if (visible && !browserConnection.loaded) browserConnection.refresh().catch(() => {});
|
||||
}, { immediate: true });
|
||||
const commandPaletteStore = useCommandPaletteStore();
|
||||
|
||||
// Platform-aware label for the ⌘K hint. navigator.platform is deprecated but
|
||||
|
|
@ -1857,6 +1872,24 @@ const resizeSidebar = (delta: number, keyboard: boolean) => {
|
|||
&:nth-child(3) { z-index: 1; --stack-rotate: 10deg; --stack-delay: 100ms; }
|
||||
}
|
||||
|
||||
.menu-toolbox-stack__status {
|
||||
position: absolute;
|
||||
right: -1px;
|
||||
bottom: -1px;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: var(--app-radius-pill);
|
||||
box-shadow: 0 0 0 1.5px var(--td-bg-color-container);
|
||||
|
||||
&.is-connected {
|
||||
background: var(--td-success-color);
|
||||
}
|
||||
|
||||
&.is-offline {
|
||||
background: var(--td-warning-color);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes menu-toolbox-stack-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ export default {
|
|||
"lastSeen": "Last connected",
|
||||
"readyHint": "Ready. Return to the conversation and describe your browser task.",
|
||||
"capabilitiesTitle": "Your agent can",
|
||||
"sidebarStatus": "Show connection status in the sidebar",
|
||||
"reconnectHint": "Authorization is saved. Keep Chrome and BrowserSkill open to reconnect automatically.",
|
||||
"replaceDevice": "Change browser",
|
||||
"installExtension": "Install BrowserSkill",
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ export default {
|
|||
"lastSeen": "最終接続",
|
||||
"readyHint": "準備完了。会話に戻り、ブラウザーで行うタスクを伝えてください。",
|
||||
"capabilitiesTitle": "エージェントができること",
|
||||
"sidebarStatus": "サイドバーに接続状態を表示",
|
||||
"reconnectHint": "認証は保存されています。Chrome と拡張機能を開くと自動的に再接続します。",
|
||||
"replaceDevice": "ブラウザーを変更",
|
||||
"installExtension": "BrowserSkill をインストール",
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ export default {
|
|||
"lastSeen": "최근 연결",
|
||||
"readyHint": "준비되었습니다. 대화로 돌아가 브라우저 작업을 요청하세요.",
|
||||
"capabilitiesTitle": "에이전트가 할 수 있는 작업",
|
||||
"sidebarStatus": "사이드바에 연결 상태 표시",
|
||||
"reconnectHint": "인증이 저장되어 있습니다. Chrome과 확장 프로그램을 열면 자동으로 다시 연결됩니다.",
|
||||
"replaceDevice": "브라우저 변경",
|
||||
"installExtension": "BrowserSkill 설치",
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ export default {
|
|||
"lastSeen": "Последнее подключение",
|
||||
"readyHint": "Готово. Вернитесь в диалог и опишите задачу для браузера.",
|
||||
"capabilitiesTitle": "Агент может",
|
||||
"sidebarStatus": "Показывать статус подключения на боковой панели",
|
||||
"reconnectHint": "Авторизация сохранена. Откройте Chrome и BrowserSkill для автоматического подключения.",
|
||||
"replaceDevice": "Сменить браузер",
|
||||
"installExtension": "Установите BrowserSkill",
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ export default {
|
|||
"lastSeen": "最近连接",
|
||||
"readyHint": "已准备就绪。回到对话,直接描述需要浏览器完成的任务。",
|
||||
"capabilitiesTitle": "智能体可以",
|
||||
"sidebarStatus": "在侧边栏显示连接状态",
|
||||
"reconnectHint": "保留授权,等待扩展自动重连。请确认 Chrome 和 BrowserSkill 扩展已开启。",
|
||||
"replaceDevice": "更换浏览器",
|
||||
"installExtension": "安装 BrowserSkill 扩展",
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ export const useUIStore = defineStore('ui', {
|
|||
sidebarCollapsed: localStorage.getItem('sidebar_collapsed') === 'true',
|
||||
sidebarWidth: clampSidebarWidth(Number(localStorage.getItem('sidebar_width'))),
|
||||
sidebarResizing: false,
|
||||
sidebarBrowserStatus: localStorage.getItem('sidebar_browser_status') !== 'false',
|
||||
}),
|
||||
|
||||
getters: {
|
||||
|
|
@ -127,6 +128,11 @@ export const useUIStore = defineStore('ui', {
|
|||
this.selectedTagIds = []
|
||||
},
|
||||
|
||||
setSidebarBrowserStatus(visible: boolean) {
|
||||
this.sidebarBrowserStatus = visible
|
||||
localStorage.setItem('sidebar_browser_status', String(visible))
|
||||
},
|
||||
|
||||
toggleSidebar() {
|
||||
this.sidebarCollapsed = !this.sidebarCollapsed
|
||||
localStorage.setItem('sidebar_collapsed', String(this.sidebarCollapsed))
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@
|
|||
<t-icon :name="item.icon" size="16px" />{{ t(item.label) }}
|
||||
</li>
|
||||
</ul>
|
||||
<label class="sidebar-status-toggle">
|
||||
<span>{{ t('localBrowser.sidebarStatus') }}</span>
|
||||
<t-switch size="small" :value="uiStore.sidebarBrowserStatus"
|
||||
@change="(value: unknown) => uiStore.setSidebarBrowserStatus(value === true)" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="device-block">
|
||||
<div class="device-meta">
|
||||
|
|
@ -157,12 +162,14 @@ import { onMounted, onBeforeUnmount, ref } from 'vue'
|
|||
import { useI18n } from 'vue-i18n'
|
||||
import { get, post, getDown } from '@/utils/request'
|
||||
import { useBrowserConnectionStore } from '@/stores/browserConnection'
|
||||
import { useUIStore } from '@/stores/ui'
|
||||
import browserLogo from '@/assets/browserskill/logo.png'
|
||||
import BrowserSearchPreferences from './BrowserSearchPreferences.vue'
|
||||
interface Device { id: string; label: string; last_seen_at: string }
|
||||
interface Connection { enabled: boolean; connected: boolean; device?: Device; extension_available: boolean; extension_version?: string }
|
||||
const { t, locale } = useI18n()
|
||||
const browserConnection = useBrowserConnectionStore()
|
||||
const uiStore = useUIStore()
|
||||
const status = ref<Connection>({ enabled: false, connected: false, extension_available: false })
|
||||
const busy = ref(false), loaded = ref(false), error = ref(''), refreshError = ref(''), pairing = ref(''), copied = ref(false), copyFallback = ref(false), downloading = ref(false)
|
||||
const endpoint = '/api/v1/me/browser'
|
||||
|
|
@ -435,6 +442,17 @@ onBeforeUnmount(() => { alive = false; controller.abort(); clearTimeout(timer);
|
|||
}
|
||||
}
|
||||
|
||||
.sidebar-status-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-top: 14px;
|
||||
color: var(--td-text-color-secondary);
|
||||
font-size: var(--app-text-sm);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.capabilities-title {
|
||||
display: block;
|
||||
margin-bottom: 10px;
|
||||
|
|
|
|||
Loading…
Reference in New Issue