|
@@ -45,6 +45,14 @@ import type {
|
|
|
const { TextArea } = Input
|
|
const { TextArea } = Input
|
|
|
const { Text, Title } = Typography
|
|
const { Text, Title } = Typography
|
|
|
|
|
|
|
|
|
|
+/** 从 URL ?videoId=xxx 读取并校验,无效返回 null */
|
|
|
|
|
+function readUrlVideoId(): number | null {
|
|
|
|
|
+ const raw = new URLSearchParams(window.location.search).get('videoId')
|
|
|
|
|
+ if (!raw) return null
|
|
|
|
|
+ const n = Number(raw)
|
|
|
|
|
+ return Number.isFinite(n) && n > 0 ? n : null
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/** 从召回结果里剔除指定视频ID, 同时刷新 modality 计数 */
|
|
/** 从召回结果里剔除指定视频ID, 同时刷新 modality 计数 */
|
|
|
function filterOutSelf(data: RecallResultVO, excludeId: number | null): RecallResultVO {
|
|
function filterOutSelf(data: RecallResultVO, excludeId: number | null): RecallResultVO {
|
|
|
if (!excludeId) return data
|
|
if (!excludeId) return data
|
|
@@ -120,7 +128,10 @@ export default function RecallTestPage() {
|
|
|
const DEFAULT_VIDEO_ID = 64632804
|
|
const DEFAULT_VIDEO_ID = 64632804
|
|
|
|
|
|
|
|
function VideoIdTab() {
|
|
function VideoIdTab() {
|
|
|
- const [videoId, setVideoId] = useState<number | null>(DEFAULT_VIDEO_ID)
|
|
|
|
|
|
|
+ /** URL 上 ?videoId=xxx 优先于默认 ID;有则首次查询后自动按选题召回 */
|
|
|
|
|
+ const urlVideoId = readUrlVideoId()
|
|
|
|
|
+ const [videoId, setVideoId] = useState<number | null>(urlVideoId ?? DEFAULT_VIDEO_ID)
|
|
|
|
|
+ const pendingAutoRecallRef = useRef(urlVideoId !== null)
|
|
|
const [detail, setDetail] = useState<VideoBasicVO | null>(null)
|
|
const [detail, setDetail] = useState<VideoBasicVO | null>(null)
|
|
|
const [ai, setAi] = useState<AIUnderstandingVO | null>(null)
|
|
const [ai, setAi] = useState<AIUnderstandingVO | null>(null)
|
|
|
const [points, setPoints] = useState<DeconstructPointsVO | null>(null)
|
|
const [points, setPoints] = useState<DeconstructPointsVO | null>(null)
|
|
@@ -205,6 +216,17 @@ function VideoIdTab() {
|
|
|
[topN, videoId],
|
|
[topN, videoId],
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ /** URL 传入 videoId 时, 首次查询结束后自动按"选题"维度召回 (0 点击) */
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ if (!pendingAutoRecallRef.current) return
|
|
|
|
|
+ if (!autoQueriedRef.current) return
|
|
|
|
|
+ if (loadingMain) return
|
|
|
|
|
+ pendingAutoRecallRef.current = false
|
|
|
|
|
+ if (points?.topic && points.topic.trim()) {
|
|
|
|
|
+ onRecallByText(points.topic, 'VIDEO_TOPIC')
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [loadingMain, points, onRecallByText])
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<Space direction="vertical" size={16} style={{ width: '100%' }}>
|
|
<Space direction="vertical" size={16} style={{ width: '100%' }}>
|
|
|
{/* 查询条 */}
|
|
{/* 查询条 */}
|