feat(analytics): Enhance AnalystQueryPage with template and cache hit indicators

- Updated `AnalystQueryPage` to display tags for template hits and cache hits, improving user feedback on query performance.
- Adjusted SQL result label to streamline information presentation.
- Enhanced documentation to reflect the latest testing baseline with 804 passed tests, indicating improved stability and functionality across the application.

This update significantly enhances the user experience by providing clearer insights into query processing and results.
This commit is contained in:
2026-09-10 15:31:20 +08:00
parent ddcf53cfa8
commit 48355cee8e
7 changed files with 63 additions and 39 deletions
+14 -4
View File
@@ -1,4 +1,4 @@
import { Alert, Button, Card, Collapse, Input, Row, Col, Space, Spin, Table, Typography } from 'antd'
import { Alert, Button, Card, Collapse, Input, Row, Col, Space, Spin, Table, Tag, Typography } from 'antd'
import type { ColumnsType } from 'antd/es/table'
import { useEffect, useState } from 'react'
import { getAnalystDashboard, postAnalystChat, type AnalystChatResponse } from '../../api/analyst'
@@ -140,6 +140,18 @@ export function AnalystQueryPage() {
description={result.suggestions?.join(' · ')}
/>
) : null}
{(result.status === 'success' || result.status === 'degrade') &&
(result.meta.template_hit || result.meta.cache_hit) ? (
<Space wrap size={[8, 8]}>
{result.meta.template_hit ? (
<Tag color="blue">
模板命中
{result.meta.template_key ? ` · ${result.meta.template_key}` : ''}
</Tag>
) : null}
{result.meta.cache_hit ? <Tag color="green">结果缓存</Tag> : null}
</Space>
) : null}
{(result.status === 'success' || result.status === 'degrade') && result.answer ? (
<Card title="解读" size="small">
<Paragraph>{result.answer}</Paragraph>
@@ -168,9 +180,7 @@ export function AnalystQueryPage() {
items={[
{
key: 'sql',
label: `SQL(${result.meta.row_count} 行 · ${result.meta.exec_ms} ms${
result.meta.cache_hit ? ' · 缓存命中' : ''
})`,
label: `SQL(${result.meta.row_count} 行 · ${result.meta.exec_ms} ms)`,
children: <pre style={{ margin: 0, whiteSpace: 'pre-wrap' }}>{result.sql}</pre>,
},
]}