import { Button, Empty, Space, Tooltip, Typography } from 'antd' import { ThunderboltOutlined } from '@ant-design/icons' import type { AIUnderstandingVO } from '../api/types' import { ACTIVE_PARENT_BTN_STYLE, DISABLED_PARENT_BTN_STYLE } from './DeconstructTree' const { Paragraph, Text } = Typography interface Props { data: AIUnderstandingVO | null loading?: boolean /** 后端字典: 仅当对应 configCode 在字典里时, "以此召回"按钮才生效 */ configCodes: Record onRecallByText: (text: string, configCodeOverride?: string) => void } /** * 字段 → configCode 映射 * 4 个 RESULT_LOG_* 维度对应内容理解的 4 行 */ const ROW_CODE: Array<{ label: string; field: keyof AIUnderstandingVO; code: string }> = [ { label: '内容选题', field: 'contentTopic', code: 'RESULT_LOG_TOPIC' }, { label: '视频主题', field: 'videoTheme', code: 'RESULT_LOG_THEME' }, { label: '视频关键词', field: 'videoKeywords', code: 'RESULT_LOG_KEYWORDS' }, { label: '视频口播', field: 'videoNarration', code: 'RESULT_LOG_NARRATION' }, ] /** * 视频内容理解-旧 (RESULT_LOG_* 维度) * * 数据源: video:detail Redis (loghubods.video_dimension_detail_add_column 同步而来) * 视频口播 字段不在 ODPS 维度表里, 始终为 null → 按钮 disabled */ export default function AIUnderstandingPanel({ data, loading, configCodes, onRecallByText }: Props) { if (loading) return
加载中...
if (!data) return const rows = ROW_CODE.map(({ label, field, code }) => ({ label, code, value: ((data[field] as string | undefined | null) ?? '').toString().trim(), })) if (rows.every((r) => !r.value)) { return } return ( {rows.map(({ label, value, code }) => { const dictHas = code in configCodes const supported = dictHas && !!value const tip = !dictHas ? `当前未启用"${label}"维度向量召回 (${code} 不在后端字典)` : !value ? '该字段无内容,无法召回' : '' const btn = supported ? ( ) : ( ) return (
{label}
{value ? ( {value} ) : ( - )}
{btn}
) })} {data.dt && ( 数据分区: {data.dt} )}
) }