feat: 템플릿(6종) + 강도 조절(3단계) + 커스텀 프롬프트

회의록 외 다양한 용도로 쓸 수 있도록 출력 구조와 요약 깊이를 분리.

템플릿:
- 🗂️ 회의록 (표준, 라이브 O)
- 🎓 강의·세미나 노트 (상세, 라이브 O)
- 🤝 1:1 미팅 (표준, 라이브 O)
- 💡 브레인스토밍 (상세, 라이브 O)
- 🎤 인터뷰 (표준, 라이브 X — Q&A 포맷)
- 📝 원문 정리 (상세 고정, 라이브 X — 요약 없이 문단화만)
- ⚙️ 커스텀 (자유 프롬프트)

강도: 간결 / 표준 / 상세 — 템플릿별 기본값 프리셋, 언제든 override.

변경:
- src/lib/templates.ts 신규 — 프리셋 + 프롬프트 빌더
- minutes-generator / live-summary 가 buildPrompt 공유
- /api/summarize{-live} 가 template/depth/customPrompt 파라미터 수용
- page.tsx UI: 템플릿 픽커, 강도 라디오, 커스텀 textarea
- LiveRecorder 가 설정을 useLiveSummary 로 전달 (ref 기반 최신값)
- 단순 변환 모드는 기존 동작 유지 (템플릿 미적용)
- 프롬프트 빌더 단위 테스트 19개 (총 57 tests)
This commit is contained in:
2026-04-21 19:38:24 +09:00
parent 6e104cbca1
commit 0101e4b0d2
9 changed files with 675 additions and 64 deletions
+21 -27
View File
@@ -1,34 +1,22 @@
import {
buildPrompt,
resolveDepth,
type SummaryDepth,
type TemplateId,
} from './templates'
type LiveSummaryResult =
| { success: true; markdown: string }
| { success: false; error: string; rateLimited?: boolean }
interface LiveSummaryOptions {
apiKey: string
template?: TemplateId
depth?: SummaryDepth
customPrompt?: string
fetchFn?: typeof fetch
}
const LIVE_PROMPT = `회의가 아직 진행 중입니다. 지금까지의 발화 내용을 기반으로 짧고 구조화된 중간 요약을 작성하세요.
형식 (마크다운):
## 요약
(핵심 내용 3줄 이내)
## 주요 논의 사항
1. ...
2. ...
## 액션 아이템
- [ ] ...
규칙:
- 확정되지 않은 결정은 "(논의 중)"으로 표시
- 액션 아이템은 담당자/기한이 명확한 것만 포함
- 한국어로, 간결하게
---
음성 인식 텍스트:
`
export async function generateLiveSummary(
transcript: string,
options: LiveSummaryOptions,
@@ -44,6 +32,16 @@ export async function generateLiveSummary(
return { success: false, error: '요약할 텍스트가 비어 있습니다.' }
}
const templateId = options.template ?? 'meeting'
const depth = resolveDepth(templateId, options.depth)
const prompt = buildPrompt({
templateId,
depth,
transcript: trimmed,
live: true,
customPrompt: options.customPrompt,
})
const url =
'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-lite:generateContent'
@@ -55,11 +53,7 @@ export async function generateLiveSummary(
'x-goog-api-key': apiKey,
},
body: JSON.stringify({
contents: [
{
parts: [{ text: `${LIVE_PROMPT}${trimmed}` }],
},
],
contents: [{ parts: [{ text: prompt }] }],
}),
})