diff --git a/pages/[...slug].tsx b/pages/[...slug].tsx index 0b8ee290..1ca4db38 100644 --- a/pages/[...slug].tsx +++ b/pages/[...slug].tsx @@ -19,6 +19,7 @@ export const Home: NextPage = () => { const router = useRouter(); const urlState = router.query.slug; const [summary, setSummary] = useState(""); + const [bvId, setBvId] = useState(""); const [loading, setLoading] = useState(false); const [curVideo, setCurVideo] = useState(""); const [apiKey, setAPIKey] = useLocalStorage("user-openai-apikey"); @@ -61,9 +62,8 @@ export const Home: NextPage = () => { const videoUrl = url ? url : curVideo; const matchResult = videoUrl.match(/\/video\/([^\/\?]+)/); - let bvId: string | undefined; if (matchResult) { - bvId = matchResult[1]; + setBvId(matchResult[1]); } else { return toast.error("暂不支持此视频链接"); } @@ -231,7 +231,7 @@ export const Home: NextPage = () => { target="_blank" rel="noreferrer" > - 【📝 总结】 + {`【📝 总结:${bvId}】`}