From f569558a14f3c7ccde7e2171d00228105938e103 Mon Sep 17 00:00:00 2001 From: optrader Date: Thu, 30 Oct 2025 07:12:09 +0900 Subject: [PATCH] [251030] fix: WebSpeech SilenceDetection disable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ๐Ÿ• ์ปค๋ฐ‹ ์‹œ๊ฐ„: 2025. 10. 30. 07:12:09 ๐Ÿ“Š ๋ณ€๊ฒฝ ํ†ต๊ณ„: โ€ข ์ด ํŒŒ์ผ: 3๊ฐœ โ€ข ์ถ”๊ฐ€: +72์ค„ โ€ข ์‚ญ์ œ: -54์ค„ ๐Ÿ“ ์ˆ˜์ •๋œ ํŒŒ์ผ: ~ com.twin.app.shoptime/.gitignore ~ com.twin.app.shoptime/src/hooks/useReviews/useReviews.js ~ com.twin.app.shoptime/src/views/SearchPanel/VoiceInputOverlay/VoiceInputOverlay.jsx ๐Ÿ”ง ์ฃผ์š” ๋ณ€๊ฒฝ ๋‚ด์šฉ: โ€ข ํ•ต์‹ฌ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ๊ฐœ์„  โ€ข ์†Œ๊ทœ๋ชจ ๊ธฐ๋Šฅ ๊ฐœ์„  โ€ข ์ฝ”๋“œ ์ •๋ฆฌ ๋ฐ ์ตœ์ ํ™” --- com.twin.app.shoptime/.gitignore | 4 + .../src/hooks/useReviews/useReviews.js | 88 +++++++++---------- .../VoiceInputOverlay/VoiceInputOverlay.jsx | 34 ++++--- 3 files changed, 72 insertions(+), 54 deletions(-) diff --git a/com.twin.app.shoptime/.gitignore b/com.twin.app.shoptime/.gitignore index 3af5cd71..5f9dd3b1 100644 --- a/com.twin.app.shoptime/.gitignore +++ b/com.twin.app.shoptime/.gitignore @@ -15,6 +15,10 @@ npm-debug.log # ipk file srcBackup # com.lgshop.app_*.ipk +.doc .docs nul .txt + +.optimal +OPTIMAL.md diff --git a/com.twin.app.shoptime/src/hooks/useReviews/useReviews.js b/com.twin.app.shoptime/src/hooks/useReviews/useReviews.js index 2b78cd55..a0254862 100644 --- a/com.twin.app.shoptime/src/hooks/useReviews/useReviews.js +++ b/com.twin.app.shoptime/src/hooks/useReviews/useReviews.js @@ -28,27 +28,27 @@ const useReviews = (prdtId, patnrId, _deprecatedReviewVersion) => { // Redux ์ƒํƒœ์—์„œ ๋ฆฌ๋ทฐ ๋ฐ์ดํ„ฐ ๊ฐ€์ ธ์˜ค๊ธฐ - reviewVersion์— ๋”ฐ๋ผ ์„ ํƒ const reviewData = useSelector((state) => { // v2 ๋””๋ฒ„๊น…: ์ „์ฒด product state ํ™•์ธ - if (reviewVersion === 2) { - console.log('[useReviews_useReviewList] ๐Ÿ“ฅ ์ „์ฒด Redux state.product ์ƒํƒœ:', { - keys: Object.keys(state.product), - reviewData: state.product.reviewData, - reviewListData: state.product.reviewListData, - loadedPrdtId: state.product.loadedPrdtId, - loadedListPrdtId: state.product.loadedListPrdtId - }); - } + // if (reviewVersion === 2) { + // console.log('[useReviews_useReviewList] ๐Ÿ“ฅ ์ „์ฒด Redux state.product ์ƒํƒœ:', { + // keys: Object.keys(state.product), + // reviewData: state.product.reviewData, + // reviewListData: state.product.reviewListData, + // loadedPrdtId: state.product.loadedPrdtId, + // loadedListPrdtId: state.product.loadedListPrdtId + // }); + // } const data = reviewVersion === 1 ? state.product.reviewData : state.product.reviewListData; - console.log('[useReviews_useReviewList] ๐Ÿ“ฅ Redux reviewData ์„ ํƒ:', { - reviewVersion, - selectedState: reviewVersion === 1 ? 'reviewData' : 'reviewListData', - dataExists: !!data, - dataKeys: data ? Object.keys(data) : 'null', - reviewListLength: data?.reviewList?.length || 0 - }); + // console.log('[useReviews_useReviewList] ๐Ÿ“ฅ Redux reviewData ์„ ํƒ:', { + // reviewVersion, + // selectedState: reviewVersion === 1 ? 'reviewData' : 'reviewListData', + // dataExists: !!data, + // dataKeys: data ? Object.keys(data) : 'null', + // reviewListLength: data?.reviewList?.length || 0 + // }); return data; }); @@ -58,11 +58,11 @@ const useReviews = (prdtId, patnrId, _deprecatedReviewVersion) => { ? state.product.loadedPrdtId : state.product.loadedListPrdtId; - console.log('[useReviews_useReviewList] ๐Ÿ”‘ Redux loadedPrdtId ์„ ํƒ:', { - reviewVersion, - selectedState: reviewVersion === 1 ? 'loadedPrdtId' : 'loadedListPrdtId', - loadedPrdtId: id - }); + // console.log('[useReviews_useReviewList] ๐Ÿ”‘ Redux loadedPrdtId ์„ ํƒ:', { + // reviewVersion, + // selectedState: reviewVersion === 1 ? 'loadedPrdtId' : 'loadedListPrdtId', + // loadedPrdtId: id + // }); return id; }); @@ -647,17 +647,17 @@ const useReviews = (prdtId, patnrId, _deprecatedReviewVersion) => { totalRatingCount: actualReviewCount, // ์‹ค์ œ๋กœ ๋ฐ›์€ ๋ฆฌ๋ทฐ ๊ฐœ์ˆ˜ ์‚ฌ์šฉ }; - console.log('[useReviews_useReviewList] ๐Ÿ“Š stats ๊ณ„์‚ฐ:', { - actualReviewCount, - apiTotalCount, - allReviewsLength: allReviews.length, - hasLoadedData, - isLoading, - isCurrentProductLoaded, - reviewVersion, - loadedPrdtId, - prdtId - }); + // console.log('[useReviews_useReviewList] ๐Ÿ“Š stats ๊ณ„์‚ฐ:', { + // actualReviewCount, + // apiTotalCount, + // allReviewsLength: allReviews.length, + // hasLoadedData, + // isLoading, + // isCurrentProductLoaded, + // reviewVersion, + // loadedPrdtId, + // prdtId + // }); return result; }, [allReviews.length, filteredReviews.length, displayReviews.length, reviewDetail, hasLoadedData, isLoading, isCurrentProductLoaded, reviewVersion, loadedPrdtId, prdtId]); @@ -675,18 +675,18 @@ const useReviews = (prdtId, patnrId, _deprecatedReviewVersion) => { const hasReviews = allReviews.length > 0 && hasLoadedData && !isLoading && isCurrentProductLoaded; // hasReviews ๊ณ„์‚ฐ ๋กœ๊ทธ - useEffect(() => { - console.log('[useReviews_useReviewList] ๐Ÿ”ด hasReviews ๊ณ„์‚ฐ:', { - allReviewsLength: allReviews.length, - hasLoadedData, - isLoading, - isCurrentProductLoaded, - loadedPrdtId, - prdtId, - resultHasReviews: hasReviews, - reviewVersion - }); - }, [hasReviews, allReviews.length, hasLoadedData, isLoading, isCurrentProductLoaded, loadedPrdtId, prdtId, reviewVersion]); + // useEffect(() => { + // console.log('[useReviews_useReviewList] ๐Ÿ”ด hasReviews ๊ณ„์‚ฐ:', { + // allReviewsLength: allReviews.length, + // hasLoadedData, + // isLoading, + // isCurrentProductLoaded, + // loadedPrdtId, + // prdtId, + // resultHasReviews: hasReviews, + // reviewVersion + // }); + // }, [hasReviews, allReviews.length, hasLoadedData, isLoading, isCurrentProductLoaded, loadedPrdtId, prdtId, reviewVersion]); return { // ๐Ÿ”ฅ ํ•ต์‹ฌ API ํ•จ์ˆ˜ - useReviews๊ฐ€ ๋ชจ๋“  API ํ˜ธ์ถœ ๋‹ด๋‹น diff --git a/com.twin.app.shoptime/src/views/SearchPanel/VoiceInputOverlay/VoiceInputOverlay.jsx b/com.twin.app.shoptime/src/views/SearchPanel/VoiceInputOverlay/VoiceInputOverlay.jsx index 1e496e67..5326a88b 100644 --- a/com.twin.app.shoptime/src/views/SearchPanel/VoiceInputOverlay/VoiceInputOverlay.jsx +++ b/com.twin.app.shoptime/src/views/SearchPanel/VoiceInputOverlay/VoiceInputOverlay.jsx @@ -95,6 +95,11 @@ const DEFAULT_SUGGESTIONS = [ // false๋กœ ์„ค์ •ํ•˜๋ฉด ์ด ๊ธฐ๋Šฅ์€ ์™„์ „ํžˆ ๋น„ํ™œ์„ฑํ™”๋ฉ๋‹ˆ๋‹ค const ENABLE_WAKE_WORD = false; +// ๐Ÿ”ง Silence Detection ํ™œ์„ฑํ™” ์—ฌ๋ถ€ +// continuous: true์—์„œ ๋…ธ์ด์ฆˆ๋ฅผ interim์œผ๋กœ ๊ฐ์ง€ํ•  ์ˆ˜ ์žˆ์–ด +// ์‚ฌ์šฉ์ž๊ฐ€ ์ค€๋น„ ๋‹จ๊ณ„์—์„œ ์กฐ๊ธฐ ์ข…๋ฃŒ๋  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ false๋กœ ์„ค์ • +const IS_SILENCE_CHECK_ENABLED = false; + // Utility function to clear a single timer ref (timeout) const clearTimerRef = (timerRef) => { if (timerRef.current) { @@ -852,29 +857,38 @@ const VoiceInputOverlay = ({ // } // }, [voiceInputMode, currentMode, isListening, startListening, stopListening]); - // ๐ŸŽค Interim ํ…์ŠคํŠธ ์‹ค์‹œ๊ฐ„ ํ‘œ์‹œ ๋ฐ ref ์—…๋ฐ์ดํŠธ + 3์ดˆ silence detection + // ๐ŸŽค Interim ํ…์ŠคํŠธ ์‹ค์‹œ๊ฐ„ ํ‘œ์‹œ ๋ฐ ref ์—…๋ฐ์ดํŠธ + // Silence Detection์€ IS_SILENCE_CHECK_ENABLED์— ๋”ฐ๋ผ ์ œ์–ด useEffect(() => { if (currentMode !== VOICE_MODES.LISTENING) { // โœ… LISTENING ๋ชจ๋“œ๊ฐ€ ์•„๋‹ˆ๋ฉด ํƒ€์ด๋จธ ์ •๋ฆฌ - clearTimerRef(silenceDetectionTimerRef); - silenceDetectionTimerRef.current = null; + if (IS_SILENCE_CHECK_ENABLED) { + clearTimerRef(silenceDetectionTimerRef); + silenceDetectionTimerRef.current = null; + } return; } // โœ… Ref ์—…๋ฐ์ดํŠธ (15์ดˆ ํƒ€์ด๋จธ์—์„œ ์ตœ์‹  ๊ฐ’์„ ์ฝ์„ ์ˆ˜ ์žˆ๋„๋ก) interimTextRef.current = interimText || ''; + // โœจ TInput์— ์‹ค์‹œ๊ฐ„์œผ๋กœ ํ…์ŠคํŠธ ํ‘œ์‹œ + if (onSearchChange && interimText) { + onSearchChange({ value: interimText }); + } + + // โœ… Silence Detection (IS_SILENCE_CHECK_ENABLED === true์ผ ๋•Œ๋งŒ) + if (!IS_SILENCE_CHECK_ENABLED) { + // Silence Detection ๋น„ํ™œ์„ฑํ™” - 15์ดˆ ํƒ€์ด๋จธ์—๋งŒ ์˜์กด + return; + } + if (!interimText) { // ์ž…๋ ฅ์ด ์—†์œผ๋ฉด silence detection ์‹œ์ž‘ํ•˜์ง€ ์•Š์Œ return; } - // โœจ TInput์— ์‹ค์‹œ๊ฐ„์œผ๋กœ ํ…์ŠคํŠธ ํ‘œ์‹œ - if (onSearchChange) { - onSearchChange({ value: interimText }); - } - - // โœ… 3์ดˆ silence detection: ๋งˆ์ง€๋ง‰ ์ž…๋ ฅ ํ›„ 3์ดˆ ๋™์•ˆ ์ถ”๊ฐ€ ์ž…๋ ฅ์ด ์—†์œผ๋ฉด ์ž๋™ ์ข…๋ฃŒ + // 3์ดˆ silence detection: ๋งˆ์ง€๋ง‰ ์ž…๋ ฅ ํ›„ 3์ดˆ ๋™์•ˆ ์ถ”๊ฐ€ ์ž…๋ ฅ์ด ์—†์œผ๋ฉด ์ž๋™ ์ข…๋ฃŒ clearTimerRef(silenceDetectionTimerRef); silenceDetectionTimerRef.current = setTimeout(() => { console.log('[VoiceInput] ๐Ÿ”‡ 3์ดˆ ๋™์•ˆ ์ž…๋ ฅ ์—†์Œ - ์ž๋™ ์ข…๋ฃŒ'); @@ -887,7 +901,7 @@ const VoiceInputOverlay = ({ clearTimerRef(silenceDetectionTimerRef); silenceDetectionTimerRef.current = null; }; - }, [interimText, currentMode, onSearchChange, processFinalVoiceInput, addWebSpeechEventLog]); + }, [interimText, currentMode, onSearchChange, processFinalVoiceInput, addWebSpeechEventLog, IS_SILENCE_CHECK_ENABLED]); // ๐ŸŽ‰ Wake Word Detection: PROMPT ๋ชจ๋“œ์—์„œ ๋ฐฑ๊ทธ๋ผ์šด๋“œ ๋ฆฌ์Šค๋‹ ์‹œ์ž‘ useEffect(() => {