refactor: 前端界面微调

This commit is contained in:
mofeng-git
2026-06-15 23:36:17 +08:00
parent e2c19d550c
commit f1e362a820
14 changed files with 141 additions and 95 deletions

View File

@@ -1,5 +1,6 @@
import { ref, onUnmounted } from 'vue'
import { buildWsUrl } from '@/types/websocket'
import { generateUUID } from '@/lib/utils'
import type { ComputerUseScreenshot, ComputerUseSession, ComputerUseAction } from '@/api'
export type ComputerUseServerMessage =
@@ -16,7 +17,7 @@ export function useComputerUseSocket(options: {
}) {
const connected = ref(false)
const error = ref<string | null>(null)
const clientId = crypto.randomUUID()
const clientId = generateUUID()
let ws: WebSocket | null = null
let connectPromise: Promise<void> | null = null

View File

@@ -0,0 +1,20 @@
import { useLocalStorage } from '@vueuse/core'
import type { RemovableRef } from '@vueuse/core'
export type FeatureVisibilityKey = 'webTerminal' | 'computerUse'
export type FeatureVisibility = Record<FeatureVisibilityKey, boolean>
const DEFAULT_FEATURE_VISIBILITY: FeatureVisibility = {
webTerminal: true,
computerUse: true,
}
const featureVisibility = useLocalStorage<FeatureVisibility>(
'featureVisibility',
DEFAULT_FEATURE_VISIBILITY,
{ mergeDefaults: true },
)
export function useFeatureVisibility(): RemovableRef<FeatureVisibility> {
return featureVisibility
}