Files
zclaw_openfang/admin-v2/src/main.tsx
iven 6cae768401
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
fix(desktop): session persistence — refresh/login/context/empty-content 4-bug fix
1. App.tsx: add restoreSession() call on startup to prevent redirect
   to login page after refresh (isRestoring guard + BootstrapScreen)
2. CloneManager: call syncAgents() after loadClones() to restore
   currentAgent and conversation history on app load
3. zclaw-memory: add get_or_create_session() so frontend session UUID
   is persisted directly — kernel no longer creates mismatched IDs
4. openai.rs: assistant message content must be non-empty for
   Kimi/Qwen APIs — replace empty content with meaningful placeholders

Also includes admin-v2 ModelServices unified page (merge providers +
models + API keys into expandable row layout)
2026-03-31 13:38:59 +08:00

89 lines
2.7 KiB
TypeScript

import { createRoot } from 'react-dom/client'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { RouterProvider } from 'react-router-dom'
import { ConfigProvider, App as AntApp, theme } from 'antd'
import zhCN from 'antd/locale/zh_CN'
import { router } from './router'
import { ErrorBoundary } from './components/ErrorBoundary'
import { useThemeStore } from './stores/themeStore'
import './styles/globals.css'
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: 1,
refetchOnWindowFocus: false,
staleTime: 30_000,
},
},
})
function ThemedApp() {
const resolved = useThemeStore((s) => s.resolved)
return (
<ConfigProvider
locale={zhCN}
theme={{
token: {
colorPrimary: '#863bff',
colorBgContainer: resolved === 'dark' ? '#292524' : '#ffffff',
colorBgElevated: resolved === 'dark' ? '#1c1917' : '#ffffff',
colorBgLayout: resolved === 'dark' ? '#0c0a09' : '#fafaf9',
colorBorder: resolved === 'dark' ? '#44403c' : '#e7e5e4',
colorBorderSecondary: resolved === 'dark' ? '#44403c' : '#f5f5f4',
colorText: resolved === 'dark' ? '#fafaf9' : '#1c1917',
colorTextSecondary: resolved === 'dark' ? '#a8a29e' : '#78716c',
colorTextTertiary: resolved === 'dark' ? '#78716c' : '#a8a29e',
borderRadius: 8,
borderRadiusLG: 12,
fontFamily:
'"Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
fontSize: 14,
controlHeight: 36,
},
algorithm: resolved === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm,
components: {
Card: {
borderRadiusLG: 12,
},
Table: {
borderRadiusLG: 12,
headerBg: resolved === 'dark' ? '#1c1917' : '#fafaf9',
headerColor: resolved === 'dark' ? '#a8a29e' : '#78716c',
rowHoverBg: resolved === 'dark' ? 'rgba(134,59,255,0.06)' : 'rgba(134,59,255,0.04)',
},
Button: {
borderRadius: 8,
controlHeight: 36,
},
Input: {
borderRadius: 8,
},
Select: {
borderRadius: 8,
},
Modal: {
borderRadiusLG: 12,
},
Tag: {
borderRadiusSM: 9999,
},
},
}}
>
<AntApp>
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} />
</QueryClientProvider>
</AntApp>
</ConfigProvider>
)
}
createRoot(document.getElementById('root')!).render(
<ErrorBoundary>
<ThemedApp />
</ErrorBoundary>,
)