@startuml !theme mono title STT Service - 음성텍스트변환 내부 시퀀스 participant "Frontend<>" as Frontend participant "TranscriptController" as Controller participant "TranscriptService" as Service participant "RecordingRepository" as RecordingRepo participant "TranscriptRepository" as TranscriptRepo participant "AzureSpeechClient" as AzureClient database "STT DB" as DB database "Azure Blob Storage<>" as BlobStorage queue "Azure Event Hubs<>" as EventHub == 음성 데이터 스트리밍 수신 (5초 간격 배치) == Frontend -> Controller: POST /api/transcripts/stream\n(audioData, recordingId, timestamp) activate Controller Controller -> Service: processAudioStream(audioData, recordingId) activate Service == 음성 인식 처리 == Service -> AzureClient: recognizeAudio(audioData) activate AzureClient AzureClient -> AzureClient: 음성 인식 수행 note right - 실시간 STT 처리 - 화자 식별 (Speaker Diarization) - 타임스탬프 자동 기록 - 신뢰도 점수 계산 end note AzureClient -> BlobStorage: 음성 파일 저장\n(chunk 단위 저장) activate BlobStorage BlobStorage --> AzureClient: 저장 완료 deactivate BlobStorage AzureClient --> Service: RecognitionResult\n(text, speakerId, confidence, timestamp) deactivate AzureClient == 정확도 검증 및 처리 == Service -> Service: 정확도 점수 검증 note right confidence >= 60%: 정상 처리 confidence < 60%: 경고 플래그 설정 end note == 변환 결과 저장 == Service -> TranscriptRepo: createTranscript(recordingId, text, metadata) activate TranscriptRepo TranscriptRepo -> DB: 변환 결과 저장\n(텍스트ID, 녹음ID, 화자ID, 텍스트, 신뢰도, 타임스탬프, 경고플래그) activate DB DB --> TranscriptRepo: transcriptId 반환 deactivate DB TranscriptRepo --> Service: TranscriptEntity 반환 deactivate TranscriptRepo == 화자 정보 업데이트 == Service -> RecordingRepo: updateSpeakerInfo(recordingId, speakerId) activate RecordingRepo RecordingRepo -> DB: 화자 정보 저장/업데이트\n(녹음ID, 화자ID, 세그먼트수) activate DB DB --> RecordingRepo: 업데이트 완료 deactivate DB RecordingRepo --> Service: 완료 deactivate RecordingRepo == 이벤트 발행 == Service -> EventHub: TranscriptReady 이벤트 발행 activate EventHub note right of EventHub 이벤트 데이터: - transcriptId - recordingId - meetingId - text - speakerId - timestamp - confidence end note EventHub --> Service: 발행 완료 deactivate EventHub Service --> Controller: TranscriptResponse\n(transcriptId, text, confidence, warningFlag) deactivate Service Controller --> Frontend: 200 OK\n(transcriptId, text, speakerId, timestamp, confidence) deactivate Controller note over Frontend, EventHub 처리 시간: - Azure STT 처리: 1-3초 - DB 저장: ~100ms - Event 발행: ~50ms - 총 처리 시간: 1-4초 정확도 경고: - 60% 미만: 수동 수정 권장 - 60-80%: 검토 권장 - 80% 이상: 정상 end note @enduml