|
|
@@ -449,15 +449,28 @@ function TextRecallTab() {
|
|
|
const [loading, setLoading] = useState(false)
|
|
|
const configCodes = useConfigCodes()
|
|
|
const groupedOptions = buildGroupedConfigOptions(configCodes)
|
|
|
+ /** 召回结果标题展示的维度 meta — 锁定提交瞬间的值, 避免提交后改下拉影响展示 */
|
|
|
+ const [resultMeta, setResultMeta] = useState<{
|
|
|
+ dimensionLabel: string
|
|
|
+ dimensionCode: string
|
|
|
+ description: string
|
|
|
+ } | null>(null)
|
|
|
|
|
|
const onSubmit = useCallback(async () => {
|
|
|
- if (!queryText.trim()) {
|
|
|
+ const trimmed = queryText.trim()
|
|
|
+ if (!trimmed) {
|
|
|
message.warning('请输入查询文本')
|
|
|
return
|
|
|
}
|
|
|
setLoading(true)
|
|
|
+ const preview = trimmed.length > 24 ? trimmed.slice(0, 24) + '…' : trimmed
|
|
|
+ setResultMeta({
|
|
|
+ dimensionLabel: configCodes[configCode] ?? configCode,
|
|
|
+ dimensionCode: configCode,
|
|
|
+ description: `基于文本 "${preview}"`,
|
|
|
+ })
|
|
|
try {
|
|
|
- const data = await matchByText({ queryText: queryText.trim(), configCode, topN })
|
|
|
+ const data = await matchByText({ queryText: trimmed, configCode, topN })
|
|
|
setResult(data)
|
|
|
message.success(`召回 ${data.total} 条`)
|
|
|
} catch {
|
|
|
@@ -465,7 +478,7 @@ function TextRecallTab() {
|
|
|
} finally {
|
|
|
setLoading(false)
|
|
|
}
|
|
|
- }, [queryText, configCode, topN])
|
|
|
+ }, [queryText, configCode, topN, configCodes])
|
|
|
|
|
|
/** URL 上有 queryText 时, 挂载后自动触发一次召回 (Grafana 跳转 0 点击) */
|
|
|
const autoSearchedRef = useRef(false)
|
|
|
@@ -499,15 +512,7 @@ function TextRecallTab() {
|
|
|
</Space>
|
|
|
</Card>
|
|
|
|
|
|
- <Card
|
|
|
- size="small"
|
|
|
- title={
|
|
|
- <Space size={6}>
|
|
|
- <SearchOutlined style={{ color: '#722ed1' }} />
|
|
|
- <span>召回结果</span>
|
|
|
- </Space>
|
|
|
- }
|
|
|
- >
|
|
|
+ <Card size="small" title={<RecallTitle meta={resultMeta} />}>
|
|
|
<RecallResultList result={result} loading={loading} />
|
|
|
</Card>
|
|
|
</Space>
|