fix(desktop): session persistence — refresh/login/context/empty-content 4-bug fix
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
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
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)
This commit is contained in:
51
admin-v2/src/components/ErrorState.tsx
Normal file
51
admin-v2/src/components/ErrorState.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import { Button, Result } from 'antd'
|
||||
import type { FallbackProps } from 'react-error-boundary'
|
||||
|
||||
interface ErrorStateProps {
|
||||
title?: string
|
||||
message?: string
|
||||
onRetry?: () => void
|
||||
}
|
||||
|
||||
export function ErrorState({
|
||||
title = '加载失败',
|
||||
message,
|
||||
onRetry,
|
||||
}: ErrorStateProps) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-[200px] p-8">
|
||||
<Result
|
||||
status="error"
|
||||
title={title}
|
||||
subTitle={message}
|
||||
extra={
|
||||
onRetry ? (
|
||||
<Button type="primary" onClick={onRetry}>
|
||||
重试
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-[200px] p-8">
|
||||
<Result
|
||||
status="error"
|
||||
title="页面出现错误"
|
||||
subTitle={error.message}
|
||||
extra={
|
||||
<div className="flex gap-2">
|
||||
<Button onClick={resetErrorBoundary}>重试</Button>
|
||||
<Button type="primary" onClick={() => window.location.reload()}>
|
||||
刷新页面
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
25
admin-v2/src/components/PageHeader.tsx
Normal file
25
admin-v2/src/components/PageHeader.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
interface PageHeaderProps {
|
||||
title: string
|
||||
description?: string
|
||||
actions?: ReactNode
|
||||
}
|
||||
|
||||
export function PageHeader({ title, description, actions }: PageHeaderProps) {
|
||||
return (
|
||||
<div className="flex items-start justify-between mb-6">
|
||||
<div>
|
||||
<h1 className="text-xl font-semibold text-neutral-900 dark:text-neutral-100">
|
||||
{title}
|
||||
</h1>
|
||||
{description && (
|
||||
<p className="mt-1 text-sm text-neutral-500 dark:text-neutral-400">
|
||||
{description}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{actions && <div className="flex items-center gap-2">{actions}</div>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
15
admin-v2/src/components/StatusTag.tsx
Normal file
15
admin-v2/src/components/StatusTag.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Tag } from 'antd'
|
||||
|
||||
interface StatusTagProps {
|
||||
status: string
|
||||
labels: Record<string, string>
|
||||
colors: Record<string, string>
|
||||
}
|
||||
|
||||
export function StatusTag({ status, labels, colors }: StatusTagProps) {
|
||||
return (
|
||||
<Tag color={colors[status] || 'default'}>
|
||||
{labels[status] || status}
|
||||
</Tag>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user