From 1388c120b76e5af9cae25b4a45f5e036800d19c9 Mon Sep 17 00:00:00 2001 From: an-lee Date: Thu, 21 Mar 2024 11:28:43 +0800 Subject: [PATCH] fix caption translate & analysis --- .../components/medias/media-caption.tsx | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/enjoy/src/renderer/components/medias/media-caption.tsx b/enjoy/src/renderer/components/medias/media-caption.tsx index 2997d481..fd5fbb15 100644 --- a/enjoy/src/renderer/components/medias/media-caption.tsx +++ b/enjoy/src/renderer/components/medias/media-caption.tsx @@ -467,12 +467,11 @@ const CaptionTabs = (props: { }); }; - const translateSetence = async (options?: { force?: boolean }) => { + const translateSetence = async () => { if (translating) return; - const { force } = options || {}; setTranslating(true); - translate(caption.text, force ? null : `translate-${hash}`) + translate(caption.text, `translate-${hash}`) .then((result) => { if (result) { setTranslation(result); @@ -484,12 +483,11 @@ const CaptionTabs = (props: { }); }; - const analyzeSetence = async (options?: { force?: boolean }) => { + const analyzeSetence = async () => { if (analyzing) return; - const { force } = options || {}; setAnalyzing(true); - analyzeText(caption.text, force ? null : `analyze-${hash}`) + analyzeText(caption.text, `analyze-${hash}`) .then((result) => { if (result) { setAnalysisResult(result); @@ -646,8 +644,12 @@ const CaptionTabs = (props: { @@ -678,8 +680,12 @@ const CaptionTabs = (props: { ) : (
-