내부 시퀀스 실시간 추천 기능 DB조회 제거

This commit is contained in:
hjmoons
2025-10-22 17:32:02 +09:00
parent 18f2416414
commit b2f66756e2
3 changed files with 150 additions and 259 deletions
@@ -6,27 +6,22 @@ title AI Service 내부 시퀀스 - 결정사항제안
participant "SuggestionController" as Controller
participant "DecisionSuggestionService" as Service
participant "LLMClient" as LLM
participant "SuggestionRepository" as Repo
participant "TranscriptRepository" as TranscriptRepo
database "Azure OpenAI<<E>>" as OpenAI
database "Redis Cache<<E>>" as Cache
database "PostgreSQL<<E>>" as DB
== 실시간 결정사항 제안 요청 ==
note over Controller
TranscriptService로부터 호출
또는 API 직접 호출:
POST /api/ai/suggestions/decision
Body: {
"meetingId": "{meetingId}",
"transcriptText": "최근 대화 내용"
}
(회의록 자동작성 프로세스 내부)
end note
Controller -> Service: suggestDecisions(meetingId, transcriptText)
activate Service
== 회의 맥락 및 이전 결정 조회 ==
== 회의 맥락 조회 ==
Service -> TranscriptRepo: getMeetingContext(meetingId)
activate TranscriptRepo
@@ -40,17 +35,15 @@ deactivate DB
TranscriptRepo --> Service: meetingContext
deactivate TranscriptRepo
Service -> Repo: getPreviousDecisions(meetingId)
activate Repo
Service -> Cache: GET decisions:{meetingId}
activate Cache
note right
이전에 감지한 결정사항 조회
(중복 제거용)
end note
Repo -> DB: SELECT content FROM ai_suggestions\nWHERE meeting_id = {meetingId}\nAND suggestion_type = 'DECISION'\nAND status = 'APPLIED'
activate DB
DB --> Repo: 이미 확정된 결정사항
deactivate DB
Repo --> Service: previousDecisions
deactivate Repo
Cache --> Service: previousDecisions
deactivate Cache
== LLM 기반 결정사항 패턴 감지 ==
@@ -69,7 +62,7 @@ note right
사용자 프롬프트:
- 회의 참석자: {participants}
- 이미 확정된 결정: {previousDecisions}
- 이미 감지한 결정: {previousDecisions}
- 현재 대화 내용: {transcriptText}
지시사항:
@@ -140,7 +133,7 @@ Service -> Service: 결정사항 검증
note right
검증 기준:
- 신뢰도 70% 이상만 선택
- 중복 제거 (이미 확정된 결정)
- 중복 제거 (이미 감지한 결정)
- 명확성 검증
* 주어, 목적어가 명확한가?
* 결정 내용이 구체적인가?
@@ -155,46 +148,32 @@ loop 각 제안마다
추가 정보:
- 생성 시각
- 회의 진행 시점 (분)
- 원문 위치 (라인 번호)
- 상태: PENDING
- 관련 논의사항 참조
- 원문 위치 정보
- 고유 ID (UUID)
end note
end
== 제안 저장 ==
== 임시 캐시 저장 (선택적) ==
loop 각 검증된 제안마다
Service -> Cache: APPEND decisions:{meetingId}
activate Cache
note right
Redis에 임시 저장:
- Key: decisions:{meetingId}
- Value: JSON array (제안 목록)
- TTL: 2시간 (회의 시간)
- APPEND로 기존 목록에 추가
Service -> Repo: saveSuggestion(meetingId, decision)
activate Repo
목적:
- 중복 감지용
- 재접속 시 복원용
end note
Repo -> DB: INSERT INTO ai_suggestions
activate DB
note right
저장 데이터:
- meeting_id
- suggestion_type: 'DECISION'
- content: {decision 내용}
- category: 결정 카테고리
- decision_maker: 결정자
- participants: 참여자 목록 (JSON)
- confidence_score: 0.0-1.0
- extracted_from: 원문
- context: 결정 배경
- status: PENDING
- created_at
end note
Cache --> Service: 저장 완료
deactivate Cache
DB --> Repo: suggestionId
deactivate DB
Repo --> Service: suggestionId
deactivate Repo
end
== 응답 구성 ==
== 응답 반환 ==
Service -> Service: 응답 데이터 구성
note right
@@ -208,20 +187,22 @@ note right
"decisionMaker": "김철수",
"confidence": 0.85,
"extractedFrom": "원문 발췌",
"context": "결정 배경 설명",
"canApply": true
"context": "결정 배경 설명"
}
],
"totalCount": 제안 개수,
"displayHint": "오른쪽 탭 '결정사항' 섹션"
"timestamp": "생성 시각"
}
end note
Service --> Controller: 결정사항 제안 생성 완료
Service --> Controller: 결정사항 제안 목록
deactivate Service
Controller --> Controller: 200 OK 응답 반환
Controller --> Controller: 이벤트 데이터에 포함하여 반환
note right
TranscriptSummaryCreated 이벤트에
decisionSuggestions 필드로 포함
프론트엔드 처리:
- 오른쪽 "추천" 탭의 "결정사항" 섹션 표시
- "적용" 버튼 활성화
@@ -234,49 +215,36 @@ end note
note over Controller
사용자가 "적용" 버튼 클릭 시:
PUT /api/ai/suggestions/{suggestionId}/apply
end note
프론트엔드에서 직접 Meeting Service 호출
Controller -> Service: applySuggestion(suggestionId, meetingId)
activate Service
PUT /api/meetings/{meetingId}/transcript
Body: {
"addDecisionSection": {
"content": "결정 내용",
"category": "기술",
"decisionMaker": "김철수"
}
}
Service -> Repo: updateSuggestionStatus(suggestionId, "APPLIED")
activate Repo
Repo -> DB: UPDATE ai_suggestions\nSET status = 'APPLIED',\napplied_at = NOW()
activate DB
DB --> Repo: 업데이트 완료
deactivate DB
Repo --> Service: 완료
deactivate Repo
Service -> Service: 결정사항을 회의록에 추가
note right
Meeting Service API 호출하여
Meeting Service에서 회의록의
"결정사항" 섹션에 항목 추가
end note
Service --> Controller: 적용 완료
deactivate Service
Controller --> Controller: 200 OK
note over Controller, DB
처리 시간:
- 맥락 조회: 100-200ms
- LLM 패턴 감지: 2-3초
- 검증 및 필터링: 100-200ms
- 저장 처리: 200-300ms
총 처리 시간: 약 3-4
- 캐시 저장: 50-100ms
총 처리 시간: 약 2.5-3.5
제안 정책:
- 신뢰도 70% 이상만 제안
- 명확한 결정 표현 우선
- 중복 제거 (이미 확정된 것 제외)
- 카테고리별로 최대 10개까지
- 실시간으로 계속 감지
특징:
- DB 영구 저장 없음 (임시 데이터)
- Redis 캐시만 활용
* 중복 감지용
* 재접속 복원용
- 프론트엔드 메모리에서 관리
- "적용" 시에만 회의록에 반영
end note
@enduml