From c2b5fcbec75009f4fb203f459fc790432088e2c2 Mon Sep 17 00:00:00 2001 From: seoko97 Date: Wed, 4 Dec 2024 18:32:05 +0900 Subject: [PATCH 1/8] =?UTF-8?q?fix:=20=EC=8A=A4=ED=8A=B8=EB=A6=BC=20?= =?UTF-8?q?=EC=A2=85=EB=A3=8C=20=EC=8B=9C=20=ED=8A=B8=EB=9E=99=20=EC=A4=91?= =?UTF-8?q?=EC=A7=80=20=EC=B2=98=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/components/live/SettingDialog/SelectMedia.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/web/src/components/live/SettingDialog/SelectMedia.tsx b/apps/web/src/components/live/SettingDialog/SelectMedia.tsx index 78152dfe..1d41b3a3 100644 --- a/apps/web/src/components/live/SettingDialog/SelectMedia.tsx +++ b/apps/web/src/components/live/SettingDialog/SelectMedia.tsx @@ -28,6 +28,12 @@ function SelectMedia() { getStream(); }, [selectedVideoDeviceId]); + useEffect(() => { + return () => { + stream?.getTracks().forEach((track) => track.stop()); + }; + }, [stream]); + return (
From e406acf131fa5a742ba9c2bd705ff8c2e40d4a3e Mon Sep 17 00:00:00 2001 From: seoko97 Date: Wed, 4 Dec 2024 18:33:08 +0900 Subject: [PATCH 2/8] =?UTF-8?q?refactor:=20=EB=AF=B8=EB=94=94=EC=96=B4=20?= =?UTF-8?q?=ED=8A=B8=EB=9E=99=20=EC=8A=A4=ED=8A=B8=EB=A6=BC=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/hooks/useMediaTracks.ts | 34 ++++++---------------------- apps/web/src/utils/stream.ts | 6 ++--- 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/apps/web/src/hooks/useMediaTracks.ts b/apps/web/src/hooks/useMediaTracks.ts index 53bb6f09..41c7787c 100644 --- a/apps/web/src/hooks/useMediaTracks.ts +++ b/apps/web/src/hooks/useMediaTracks.ts @@ -31,18 +31,11 @@ const useMediaTracks = () => { ); const getCameraTrack = async () => { - if (!selectedVideoDeviceId) { - return; - } + const options = selectedVideoDeviceId ? { deviceId: selectedVideoDeviceId } : {}; - const stream = await getCameraStream({ - video: { deviceId: selectedVideoDeviceId }, - }); + const stream = await getCameraStream(options); const track = stream.getVideoTracks()[0]; - - if (!track) { - return; - } + if (!track) return; setVideo({ stream, paused: true }); @@ -50,24 +43,13 @@ const useMediaTracks = () => { }; const getAudioTrack = async () => { - if (!selectedAudioDeviceId) { - return; - } + const options = selectedAudioDeviceId ? { deviceId: selectedAudioDeviceId } : {}; - const stream = await getMicStream({ - audio: { - deviceId: { - exact: selectedAudioDeviceId, - ideal: selectedAudioDeviceId, - }, - }, - }); + const stream = await getMicStream(options); const track = stream.getAudioTracks()[0]; - if (!track) { - return; - } + if (!track) return; setAudio({ stream, paused: true }); @@ -83,9 +65,7 @@ const useMediaTracks = () => { const track = stream.getVideoTracks()[0]; - if (!track) { - return; - } + if (!track) return; setScreen({ stream, paused: false }); diff --git a/apps/web/src/utils/stream.ts b/apps/web/src/utils/stream.ts index 9bcb4440..948f743e 100644 --- a/apps/web/src/utils/stream.ts +++ b/apps/web/src/utils/stream.ts @@ -19,7 +19,7 @@ const DEFAULT_SCREEN_CONSTRAINTS: MediaTrackConstraints = { frameRate: { max: 30, ideal: 15 }, }; -const getCameraStream = async (options: MediaStreamConstraints = {}) => { +const getCameraStream = async (options: MediaTrackConstraints = {}) => { return navigator.mediaDevices.getUserMedia({ video: { ...DEFAULT_VIDEO_CONSTRAINTS, @@ -28,7 +28,7 @@ const getCameraStream = async (options: MediaStreamConstraints = {}) => { }); }; -const getMicStream = async (options: MediaStreamConstraints = {}) => { +const getMicStream = async (options: MediaTrackConstraints = {}) => { return navigator.mediaDevices.getUserMedia({ audio: { ...DEFAULT_AUDIO_CONSTRAINTS, @@ -37,7 +37,7 @@ const getMicStream = async (options: MediaStreamConstraints = {}) => { }); }; -const getScreenStream = async (options: MediaStreamConstraints = {}) => { +const getScreenStream = async (options: MediaTrackConstraints = {}) => { return navigator.mediaDevices.getDisplayMedia({ video: { ...DEFAULT_SCREEN_CONSTRAINTS, From 4441485c11cdd43aa48a2f93395de2b1761e01b1 Mon Sep 17 00:00:00 2001 From: seoko97 Date: Wed, 4 Dec 2024 18:35:36 +0900 Subject: [PATCH 3/8] =?UTF-8?q?fix:=20getCameraStream=20=ED=98=B8=EC=B6=9C?= =?UTF-8?q?=20=EC=8B=9C=20video=20=EC=98=B5=EC=85=98=EC=97=90=EC=84=9C=20d?= =?UTF-8?q?eviceId=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/components/live/SettingDialog/SelectMedia.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/components/live/SettingDialog/SelectMedia.tsx b/apps/web/src/components/live/SettingDialog/SelectMedia.tsx index 1d41b3a3..73fb42f4 100644 --- a/apps/web/src/components/live/SettingDialog/SelectMedia.tsx +++ b/apps/web/src/components/live/SettingDialog/SelectMedia.tsx @@ -18,7 +18,7 @@ function SelectMedia() { stream?.getTracks().forEach((track) => track.stop()); - const cameraStream = await getCameraStream({ video: { deviceId: selectedVideoDeviceId } }); + const cameraStream = await getCameraStream({ deviceId: selectedVideoDeviceId }); videoRef.current.srcObject = cameraStream; From 4bc1b1f098964c28d8721f2425dcd594a4c97069 Mon Sep 17 00:00:00 2001 From: seoko97 Date: Wed, 4 Dec 2024 19:17:08 +0900 Subject: [PATCH 4/8] =?UTF-8?q?fix:=20summaryText=20=ED=95=84=EB=93=9C?= =?UTF-8?q?=EC=9D=98=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=ED=83=80=EC=9E=85?= =?UTF-8?q?=EC=9D=84=20json=EC=97=90=EC=84=9C=20text=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/src/entity/summary.entity.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/entity/summary.entity.ts b/apps/api/src/entity/summary.entity.ts index db14a8fd..58dd928d 100644 --- a/apps/api/src/entity/summary.entity.ts +++ b/apps/api/src/entity/summary.entity.ts @@ -17,7 +17,7 @@ export class Summary { @Column('varchar') audioUrl: string; - @Column('json', { nullable: true }) + @Column('text', { nullable: true }) summaryText: string[]; @CreateDateColumn({ type: 'timestamp', name: 'created_at' }) From a01cd39454aa4fc103ce40c9841f585380485843 Mon Sep 17 00:00:00 2001 From: seoko97 Date: Wed, 4 Dec 2024 19:17:20 +0900 Subject: [PATCH 5/8] =?UTF-8?q?fix:=20summary=20=EB=B0=98=ED=99=98?= =?UTF-8?q?=EA=B0=92=EC=9D=84=20summaryText=EC=97=90=EC=84=9C=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=20summary=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/src/stream/stream.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api/src/stream/stream.service.ts b/apps/api/src/stream/stream.service.ts index 77e1924f..c2287e1b 100644 --- a/apps/api/src/stream/stream.service.ts +++ b/apps/api/src/stream/stream.service.ts @@ -107,7 +107,8 @@ export class StreamService { const summary = await this.summaryRepository.findOne({ where: { ticle: { id: ticleId } }, }); - return summary.summaryText; + + return summary; } async updateSummaryText(summary: Summary, summaryText: string[]) { From ec5cfebeead48c00f432bfa3b123322cf0e7bbd5 Mon Sep 17 00:00:00 2001 From: seoko97 Date: Wed, 4 Dec 2024 19:18:51 +0900 Subject: [PATCH 6/8] =?UTF-8?q?fix:=20getSummaryText=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=EB=A5=BC=20getSummary=EB=A1=9C=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EB=B0=98=ED=99=98=EA=B0=92?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/src/stream/stream.controller.ts | 4 ++-- apps/api/src/stream/stream.service.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/api/src/stream/stream.controller.ts b/apps/api/src/stream/stream.controller.ts index 9d00f36f..84997326 100644 --- a/apps/api/src/stream/stream.controller.ts +++ b/apps/api/src/stream/stream.controller.ts @@ -19,7 +19,7 @@ export class StreamController { @Get('summary/:ticleId') async getSummaryByTicleId(@Param('ticleId') ticleId: number) { - const text = await this.streamService.getSummaryText(ticleId); - return { summary: text }; + const summary = await this.streamService.getSummary(ticleId); + return summary; } } diff --git a/apps/api/src/stream/stream.service.ts b/apps/api/src/stream/stream.service.ts index c2287e1b..4e9bfb6e 100644 --- a/apps/api/src/stream/stream.service.ts +++ b/apps/api/src/stream/stream.service.ts @@ -103,7 +103,7 @@ export class StreamService { } } - async getSummaryText(ticleId: number) { + async getSummary(ticleId: number) { const summary = await this.summaryRepository.findOne({ where: { ticle: { id: ticleId } }, }); From 29a68efc6ddc9cdb9c9e1105d45f57b3723a868d Mon Sep 17 00:00:00 2001 From: seoko97 Date: Wed, 4 Dec 2024 19:18:59 +0900 Subject: [PATCH 7/8] =?UTF-8?q?fix:=20AiSummaryDialog=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=9C=A0=EB=AC=B4=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=A5=B8=20=EB=A1=9C=EB=94=A9=20=EB=B0=8F=20=EA=B2=B0?= =?UTF-8?q?=EA=B3=BC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/dashboard/AiSummaryDialog.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/dashboard/AiSummaryDialog.tsx b/apps/web/src/components/dashboard/AiSummaryDialog.tsx index 34bd5a65..70573089 100644 --- a/apps/web/src/components/dashboard/AiSummaryDialog.tsx +++ b/apps/web/src/components/dashboard/AiSummaryDialog.tsx @@ -17,15 +17,23 @@ function AiSummaryDialog({ isOpen, onClose, ticleId }: AiSummaryDialogProps) { AI 음성 요약 - {!data || data?.summary.length === 0 ? ( + {!data && (
AI 요약을 처리중이에요.
- ) : ( -

{data?.summary[0]}

+ )} + {data && !data.summaryText && ( +
+ + AI 요약 결과가 없어요. + +
+ )} + {data && data.summaryText && ( +

{data.summaryText}

)}
From f0930e98fecf4ae6de08c606db3864bc93058088 Mon Sep 17 00:00:00 2001 From: seoko97 Date: Wed, 4 Dec 2024 19:19:05 +0900 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20DashboardAiSummaryResponseSchema=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/types/src/dashboard/getDashboardList.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/types/src/dashboard/getDashboardList.ts b/packages/types/src/dashboard/getDashboardList.ts index 23363e3c..0c1349db 100644 --- a/packages/types/src/dashboard/getDashboardList.ts +++ b/packages/types/src/dashboard/getDashboardList.ts @@ -62,8 +62,13 @@ export const DashboardApplicantsResponseSchema = z.array( export type DashboardApplicantsResponse = z.infer; -export const DashboardAiSummaryResponseSchema = z.object({ - summary: z.array(z.string()), -}); +export const DashboardAiSummaryResponseSchema = z + .object({ + id: z.number(), + summaryText: z.string().nullable(), + audioUrl: z.string(), + createdAt: z.string().datetime(), + }) + .nullable(); export type DashboardAiSummaryResponse = z.infer;