fix: optimize visualization hot paths and refine bgp brief workspace

This commit is contained in:
rayd1o
2026-04-10 02:12:29 +08:00
parent 83839b8b11
commit 749e6e76b6
18 changed files with 776 additions and 343 deletions

View File

@@ -519,60 +519,62 @@ function BGP() {
}
const briefTabContent = (
<div className="bgp-page__brief-card">
<div className="bgp-page__brief-head">
<div>
<Text strong>BGP AI </Text>
<div className="bgp-page__brief-subtitle">
Markdown
<div className="bgp-page__brief-tabpane">
<div className="bgp-page__brief-card">
<div className="bgp-page__brief-head">
<div>
<Text strong>BGP AI </Text>
<div className="bgp-page__brief-subtitle">
Markdown
</div>
</div>
<div className="bgp-page__brief-actions">
<Select
className="bgp-page__brief-select"
placeholder="选择历史简报"
value={selectedBriefId || undefined}
options={formatBriefOptions(briefOptions)}
onChange={(value) => void handleBriefSelectionChange(value)}
disabled={briefLoading || briefDetailLoading || briefOptions.length === 0}
/>
<Button
type="primary"
icon={<ReloadOutlined />}
loading={briefLoading}
onClick={() => void handleGenerateBrief()}
>
AI
</Button>
</div>
</div>
<div className="bgp-page__brief-actions">
<Select
className="bgp-page__brief-select"
placeholder="选择历史简报"
value={selectedBriefId || undefined}
options={formatBriefOptions(briefOptions)}
onChange={(value) => void handleBriefSelectionChange(value)}
disabled={briefLoading || briefDetailLoading || briefOptions.length === 0}
/>
<Button
type="primary"
icon={<ReloadOutlined />}
loading={briefLoading}
onClick={() => void handleGenerateBrief()}
>
AI
</Button>
</div>
</div>
{briefLoading || briefDetailLoading ? (
<div className="bgp-page__brief-loading">
<Spin />
<Text type="secondary">
{briefLoading ? '正在整理 BGP 事实并生成简报...' : '正在加载已保存的 BGP 简报...'}
</Text>
</div>
) : brief ? (
<Space direction="vertical" size={12} style={{ width: '100%' }}>
<Descriptions size="small" column={compactViewport ? 1 : 3} className="bgp-page__brief-meta">
<Descriptions.Item label="Provider">{brief.provider || '-'}</Descriptions.Item>
<Descriptions.Item label="模型">{brief.model || '-'}</Descriptions.Item>
<Descriptions.Item label="请求ID">{brief.request_id || '-'}</Descriptions.Item>
<Descriptions.Item label="生成时间" span={compactViewport ? 1 : 3}>
{formatDateTimeZhCN(brief.generated_at)}
</Descriptions.Item>
</Descriptions>
<div className="bgp-page__brief-content">
<MarkdownRenderer markdown={brief.content_markdown} />
{briefLoading || briefDetailLoading ? (
<div className="bgp-page__brief-loading">
<Spin />
<Text type="secondary">
{briefLoading ? '正在整理 BGP 事实并生成简报...' : '正在加载已保存的 BGP 简报...'}
</Text>
</div>
</Space>
) : (
<div className="bgp-page__brief-empty">
<Text type="secondary"> BGP Markdown </Text>
</div>
)}
) : brief ? (
<div className="bgp-page__brief-body">
<Descriptions size="small" column={compactViewport ? 1 : 3} className="bgp-page__brief-meta">
<Descriptions.Item label="Provider">{brief.provider || '-'}</Descriptions.Item>
<Descriptions.Item label="模型">{brief.model || '-'}</Descriptions.Item>
<Descriptions.Item label="请求ID">{brief.request_id || '-'}</Descriptions.Item>
<Descriptions.Item label="生成时间" span={compactViewport ? 1 : 3}>
{formatDateTimeZhCN(brief.generated_at)}
</Descriptions.Item>
</Descriptions>
<div className="bgp-page__brief-content">
<MarkdownRenderer markdown={brief.content_markdown} />
</div>
</div>
) : (
<div className="bgp-page__brief-empty">
<Text type="secondary"> BGP Markdown </Text>
</div>
)}
</div>
</div>
)