feat: 업무협의록 AI 요약 기능 구현
- MeetingLogService에 summaryType 파라미터 추가 - buildWorkMemoPrompt 메서드 추가 (고객 요구사항/합의사항/To-Do 특화) - MeetingLogController uploadFile에 summary_type 검증 추가 - work-memo-summary.blade.php 전체 UI 구현 (cyan 테마)
This commit is contained in:
@@ -216,22 +216,27 @@ public function summary(int $id): View|JsonResponse
|
||||
}
|
||||
|
||||
/**
|
||||
* 오디오 파일 업로드 및 처리 (회의록 AI 요약)
|
||||
* 오디오 파일 업로드 및 처리 (회의록/업무협의록 AI 요약)
|
||||
*/
|
||||
public function uploadFile(Request $request): JsonResponse
|
||||
{
|
||||
$validated = $request->validate([
|
||||
'audio_file' => 'required|file|mimes:webm,wav,mp3,ogg,m4a,mp4|max:102400',
|
||||
'title' => 'nullable|string|max:200',
|
||||
'summary_type' => 'nullable|string|in:meeting,work-memo',
|
||||
]);
|
||||
|
||||
$summaryType = $validated['summary_type'] ?? 'meeting';
|
||||
$defaultTitle = $summaryType === 'work-memo' ? '업로드된 업무협의록' : '업로드된 회의록';
|
||||
|
||||
$meeting = $this->meetingLogService->create([
|
||||
'title' => $validated['title'] ?? '업로드된 회의록',
|
||||
'title' => $validated['title'] ?? $defaultTitle,
|
||||
]);
|
||||
|
||||
$result = $this->meetingLogService->processUploadedFile(
|
||||
$meeting,
|
||||
$request->file('audio_file')
|
||||
$request->file('audio_file'),
|
||||
$summaryType
|
||||
);
|
||||
|
||||
if (! $result['ok']) {
|
||||
@@ -241,9 +246,11 @@ public function uploadFile(Request $request): JsonResponse
|
||||
], 500);
|
||||
}
|
||||
|
||||
$message = $summaryType === 'work-memo' ? '업무협의록이 생성되었습니다.' : '회의록이 생성되었습니다.';
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => '회의록이 생성되었습니다.',
|
||||
'message' => $message,
|
||||
'data' => $result['meeting'],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -137,8 +137,10 @@ public function processAudio(MeetingLog $meeting, string $audioBase64, int $dura
|
||||
|
||||
/**
|
||||
* AI 요약 생성 (Claude API)
|
||||
*
|
||||
* @param string $summaryType meeting|work-memo
|
||||
*/
|
||||
private function generateSummary(string $transcript): ?string
|
||||
private function generateSummary(string $transcript, string $summaryType = 'meeting'): ?string
|
||||
{
|
||||
$apiKey = config('services.claude.api_key');
|
||||
if (empty($apiKey)) {
|
||||
@@ -147,6 +149,10 @@ private function generateSummary(string $transcript): ?string
|
||||
return null;
|
||||
}
|
||||
|
||||
$prompt = $summaryType === 'work-memo'
|
||||
? $this->buildWorkMemoPrompt($transcript)
|
||||
: $this->buildSummaryPrompt($transcript);
|
||||
|
||||
try {
|
||||
$response = Http::withHeaders([
|
||||
'x-api-key' => $apiKey,
|
||||
@@ -157,7 +163,7 @@ private function generateSummary(string $transcript): ?string
|
||||
'messages' => [
|
||||
[
|
||||
'role' => 'user',
|
||||
'content' => $this->buildSummaryPrompt($transcript),
|
||||
'content' => $prompt,
|
||||
],
|
||||
],
|
||||
]);
|
||||
@@ -179,7 +185,7 @@ private function generateSummary(string $transcript): ?string
|
||||
}
|
||||
|
||||
/**
|
||||
* 요약 프롬프트 생성
|
||||
* 요약 프롬프트 생성 (일반 회의록)
|
||||
*/
|
||||
private function buildSummaryPrompt(string $transcript): string
|
||||
{
|
||||
@@ -200,6 +206,31 @@ private function buildSummaryPrompt(string $transcript): string
|
||||
PROMPT;
|
||||
}
|
||||
|
||||
/**
|
||||
* 업무협의록 프롬프트 생성 (고객사 미팅용)
|
||||
*/
|
||||
private function buildWorkMemoPrompt(string $transcript): string
|
||||
{
|
||||
return <<<PROMPT
|
||||
다음은 고객사와의 업무 협의 미팅 녹음을 텍스트로 변환한 내용입니다. 이 내용을 바탕으로 구조화된 업무협의록을 작성해주세요.
|
||||
|
||||
## 요청사항:
|
||||
1. **협의 개요**: 미팅의 목적과 핵심 내용을 3-5문장으로 요약
|
||||
2. **고객 요구사항**: 고객이 요청하거나 원하는 사항들을 구체적으로 정리
|
||||
3. **합의 사항**: 양측이 합의한 내용들 (범위, 일정, 비용, 조건 등)
|
||||
4. **미결 사항**: 추가 검토가 필요하거나 결정되지 않은 사항들
|
||||
5. **후속 조치 (To-Do)**:
|
||||
- 우리측 조치: 담당자, 기한, 세부 내용
|
||||
- 고객측 조치: 담당자, 기한, 세부 내용
|
||||
6. **특이사항/리스크**: 주의가 필요한 사항이나 잠재적 위험 요소
|
||||
|
||||
## 협의 녹취록:
|
||||
{$transcript}
|
||||
|
||||
## 업무협의록:
|
||||
PROMPT;
|
||||
}
|
||||
|
||||
/**
|
||||
* 회의록 삭제
|
||||
*/
|
||||
@@ -249,8 +280,10 @@ public function cleanupExpiredFiles(): int
|
||||
|
||||
/**
|
||||
* 업로드된 오디오 파일 처리 (회의록 AI 요약)
|
||||
*
|
||||
* @param string $summaryType meeting|work-memo
|
||||
*/
|
||||
public function processUploadedFile(MeetingLog $meeting, \Illuminate\Http\UploadedFile $file): array
|
||||
public function processUploadedFile(MeetingLog $meeting, \Illuminate\Http\UploadedFile $file, string $summaryType = 'meeting'): array
|
||||
{
|
||||
try {
|
||||
$meeting->update(['status' => MeetingLog::STATUS_PROCESSING]);
|
||||
@@ -298,8 +331,8 @@ public function processUploadedFile(MeetingLog $meeting, \Illuminate\Http\Upload
|
||||
|
||||
$meeting->update(['transcript_text' => $transcript]);
|
||||
|
||||
// 3. AI 요약 생성
|
||||
$summary = $this->generateSummary($transcript);
|
||||
// 3. AI 요약 생성 (summaryType에 따라 프롬프트 선택)
|
||||
$summary = $this->generateSummary($transcript, $summaryType);
|
||||
|
||||
$meeting->update([
|
||||
'summary_text' => $summary,
|
||||
|
||||
@@ -4,59 +4,452 @@
|
||||
|
||||
@push('styles')
|
||||
<style>
|
||||
.placeholder-container { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
|
||||
.placeholder-icon { width: 5rem; height: 5rem; margin-bottom: 2rem; opacity: 0.6; color: #7c3aed; }
|
||||
.placeholder-title { font-size: 2rem; font-weight: 700; color: #7c3aed; margin-bottom: 1rem; }
|
||||
.placeholder-subtitle { font-size: 1.25rem; color: #64748b; max-width: 500px; text-align: center; line-height: 1.8; }
|
||||
.placeholder-badge { margin-top: 2rem; padding: 0.5rem 1.5rem; background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: white; border-radius: 9999px; font-weight: 600; font-size: 0.875rem; }
|
||||
.feature-icon { width: 1.25rem; height: 1.25rem; color: #7c3aed; }
|
||||
.upload-container { max-width: 900px; margin: 0 auto; }
|
||||
|
||||
.drop-zone {
|
||||
border: 2px dashed #d1d5db;
|
||||
border-radius: 12px;
|
||||
padding: 48px 24px;
|
||||
text-align: center;
|
||||
transition: all 0.3s ease;
|
||||
background: #f9fafb;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.drop-zone:hover, .drop-zone.dragover {
|
||||
border-color: #0891b2;
|
||||
background: #ecfeff;
|
||||
}
|
||||
|
||||
.drop-zone.uploading {
|
||||
border-color: #3b82f6;
|
||||
background: #eff6ff;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.drop-zone-icon {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin: 0 auto 16px;
|
||||
color: #9ca3af;
|
||||
}
|
||||
|
||||
.drop-zone.dragover .drop-zone-icon { color: #0891b2; }
|
||||
|
||||
.file-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 16px;
|
||||
background: #f3f4f6;
|
||||
border-radius: 8px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.file-icon { width: 40px; height: 40px; color: #0891b2; }
|
||||
|
||||
.spinner {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border: 3px solid #e5e7eb;
|
||||
border-top-color: #0891b2;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
.status-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 14px;
|
||||
border-radius: 20px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.status-waiting { background: #f1f5f9; color: #64748b; }
|
||||
.status-processing { background: #dbeafe; color: #1d4ed8; }
|
||||
.status-completed { background: #dcfce7; color: #16a34a; }
|
||||
.status-error { background: #fee2e2; color: #dc2626; }
|
||||
|
||||
.meeting-card {
|
||||
transition: all 0.2s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.meeting-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.accordion-header { cursor: pointer; user-select: none; }
|
||||
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
|
||||
.accordion-content.open { max-height: 500px; }
|
||||
.accordion-icon { transition: transform 0.3s ease; }
|
||||
.accordion-icon.open { transform: rotate(180deg); }
|
||||
|
||||
.info-box {
|
||||
background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
|
||||
border: 1px solid #22d3ee;
|
||||
border-radius: 12px;
|
||||
padding: 16px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="min-h-screen bg-gradient-to-br from-violet-50 to-purple-100">
|
||||
<div class="container mx-auto px-4 py-12">
|
||||
<div class="placeholder-container">
|
||||
<svg class="placeholder-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" />
|
||||
</svg>
|
||||
<h1 class="placeholder-title">업무협의록 AI 요약</h1>
|
||||
<p class="placeholder-subtitle">
|
||||
고객사와의 미팅 녹음을 업로드하면 AI가 자동으로
|
||||
업무 협의 내용을 정리하고 후속 조치를 추출합니다.
|
||||
</p>
|
||||
<div class="placeholder-badge">AI/Automation</div>
|
||||
</div>
|
||||
<div class="upload-container">
|
||||
{{-- 헤더 --}}
|
||||
<div class="text-center mb-8">
|
||||
<h1 class="text-2xl font-bold text-gray-800 mb-2">업무협의록 AI 요약</h1>
|
||||
<p class="text-gray-500">고객사 미팅 녹음을 업로드하면 AI가 업무 협의 내용을 정리합니다</p>
|
||||
</div>
|
||||
|
||||
<div class="max-w-4xl mx-auto mt-12">
|
||||
<div class="bg-white rounded-2xl shadow-lg p-8">
|
||||
<h2 class="text-xl font-bold text-gray-800 mb-6 flex items-center">
|
||||
<svg class="feature-icon mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
</svg>
|
||||
예정 기능
|
||||
</h2>
|
||||
<div class="grid md:grid-cols-2 gap-6">
|
||||
<div class="p-4 bg-violet-50 rounded-lg">
|
||||
<h3 class="font-semibold text-violet-800 mb-2">협의록 생성</h3>
|
||||
<ul class="text-sm text-gray-600 space-y-1">
|
||||
<li>• 고객 요구사항 추출</li>
|
||||
<li>• 합의사항 정리</li>
|
||||
<li>• 일정/담당자 매핑</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="p-4 bg-blue-50 rounded-lg">
|
||||
<h3 class="font-semibold text-blue-800 mb-2">후속 관리</h3>
|
||||
<ul class="text-sm text-gray-600 space-y-1">
|
||||
<li>• To-Do 자동 생성</li>
|
||||
<li>• 일정 캘린더 연동</li>
|
||||
<li>• 이메일 발송</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{-- 안내 박스 --}}
|
||||
<div class="info-box">
|
||||
<div class="flex items-start gap-3">
|
||||
<svg class="w-6 h-6 text-cyan-600 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
||||
<div class="text-sm text-cyan-800">
|
||||
<p class="font-semibold mb-1">업무협의록 전용 AI 요약</p>
|
||||
<p>고객 요구사항, 합의 사항, 후속 조치(To-Do) 등 업무 협의에 특화된 구조로 정리됩니다.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 업로드 섹션 --}}
|
||||
<div class="bg-white rounded-xl shadow-md mb-8 p-6">
|
||||
<form id="uploadForm" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<input type="hidden" name="summary_type" value="work-memo">
|
||||
|
||||
{{-- 제목 입력 --}}
|
||||
<div class="mb-4">
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">협의록 제목</label>
|
||||
<input type="text" name="title" id="titleInput"
|
||||
class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:border-transparent"
|
||||
placeholder="예: OO기업 킥오프 미팅, XX프로젝트 요구사항 협의">
|
||||
</div>
|
||||
|
||||
{{-- 파일 드롭존 --}}
|
||||
<div class="drop-zone" id="dropZone" onclick="document.getElementById('fileInput').click()">
|
||||
<svg class="drop-zone-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
|
||||
</svg>
|
||||
<p class="text-lg font-medium text-gray-700 mb-2">파일을 드래그하거나 클릭하여 업로드</p>
|
||||
<p class="text-sm text-gray-500">지원 형식: WebM, WAV, MP3, OGG, M4A, MP4 (최대 100MB)</p>
|
||||
<input type="file" name="audio_file" id="fileInput" class="hidden"
|
||||
accept=".webm,.wav,.mp3,.ogg,.m4a,.mp4,audio/*">
|
||||
</div>
|
||||
|
||||
{{-- 선택된 파일 정보 --}}
|
||||
<div class="file-info hidden" id="fileInfo">
|
||||
<svg class="file-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3" />
|
||||
</svg>
|
||||
<div class="flex-1 min-w-0">
|
||||
<p class="font-medium text-gray-800 truncate" id="fileName"></p>
|
||||
<p class="text-sm text-gray-500" id="fileSize"></p>
|
||||
</div>
|
||||
<button type="button" class="text-gray-400 hover:text-gray-600" onclick="clearFile()">
|
||||
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{{-- 업로드 버튼 --}}
|
||||
<button type="submit" id="uploadBtn"
|
||||
class="w-full mt-6 py-3 px-6 bg-cyan-600 hover:bg-cyan-700 disabled:bg-gray-400 disabled:cursor-not-allowed text-white font-semibold rounded-lg transition-colors"
|
||||
disabled>
|
||||
<span id="uploadBtnText">파일을 선택해주세요</span>
|
||||
<span id="uploadBtnSpinner" class="hidden inline-flex items-center">
|
||||
<div class="spinner mr-2"></div>
|
||||
처리 중...
|
||||
</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{{-- 처리 중 상태 --}}
|
||||
<div class="bg-white rounded-xl shadow-md mb-8 p-8 hidden" id="processingCard">
|
||||
<div class="flex flex-col items-center text-center">
|
||||
<div class="spinner" style="width:40px;height:40px;border-width:4px;"></div>
|
||||
<h3 class="text-lg font-semibold mt-4 text-gray-800">AI가 업무협의록을 작성하고 있습니다</h3>
|
||||
<p class="text-sm text-gray-500 mt-2" id="processingStatus">음성을 텍스트로 변환 중...</p>
|
||||
<div class="w-56 h-2 bg-gray-200 rounded-full mt-4 overflow-hidden">
|
||||
<div class="h-full bg-cyan-500 rounded-full transition-all" id="progressBar" style="width: 0%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 결과 섹션 --}}
|
||||
<div class="hidden" id="resultSection">
|
||||
<div class="bg-white rounded-xl shadow-md mb-6 p-6">
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<h2 class="text-lg font-bold text-gray-800 flex items-center gap-2">
|
||||
<svg class="w-5 h-5 text-cyan-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" />
|
||||
</svg>
|
||||
업무협의록 AI 요약
|
||||
</h2>
|
||||
<button class="px-4 py-2 text-sm font-medium text-gray-700 bg-gray-100 hover:bg-gray-200 rounded-lg transition-colors" onclick="resetForm()">새 파일 업로드</button>
|
||||
</div>
|
||||
|
||||
{{-- 요약 내용 --}}
|
||||
<div class="bg-cyan-50 rounded-lg p-4 mb-4">
|
||||
<h3 class="font-semibold text-gray-800 mb-2">협의록 요약</h3>
|
||||
<div id="summaryContent" class="text-gray-700 prose max-w-none"></div>
|
||||
</div>
|
||||
|
||||
{{-- 원본 텍스트 (아코디언) --}}
|
||||
<div class="bg-gray-50 rounded-lg overflow-hidden">
|
||||
<div class="accordion-header flex items-center justify-between p-4" onclick="toggleAccordion(this)">
|
||||
<span class="font-medium text-gray-800">원본 녹취록 보기</span>
|
||||
<svg class="accordion-icon w-5 h-5 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="accordion-content">
|
||||
<div id="transcriptContent" class="px-4 pb-4 text-sm text-gray-600 whitespace-pre-wrap"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- 최근 협의록 목록 --}}
|
||||
<div class="bg-white rounded-xl shadow-md p-6">
|
||||
<h2 class="text-lg font-bold text-gray-800 mb-4 flex items-center gap-2">
|
||||
<svg class="w-5 h-5 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
|
||||
</svg>
|
||||
최근 협의록
|
||||
</h2>
|
||||
|
||||
<div id="meetingList" hx-get="{{ route('api.admin.meeting-logs.index') }}" hx-trigger="load" hx-swap="innerHTML">
|
||||
<div class="flex justify-center py-8">
|
||||
<div class="spinner"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
const dropZone = document.getElementById('dropZone');
|
||||
const fileInput = document.getElementById('fileInput');
|
||||
const fileInfo = document.getElementById('fileInfo');
|
||||
const uploadBtn = document.getElementById('uploadBtn');
|
||||
const uploadForm = document.getElementById('uploadForm');
|
||||
|
||||
// 드래그 앤 드롭 이벤트
|
||||
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
||||
dropZone.addEventListener(eventName, (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
|
||||
['dragenter', 'dragover'].forEach(eventName => {
|
||||
dropZone.addEventListener(eventName, () => dropZone.classList.add('dragover'));
|
||||
});
|
||||
|
||||
['dragleave', 'drop'].forEach(eventName => {
|
||||
dropZone.addEventListener(eventName, () => dropZone.classList.remove('dragover'));
|
||||
});
|
||||
|
||||
dropZone.addEventListener('drop', (e) => {
|
||||
const files = e.dataTransfer.files;
|
||||
if (files.length > 0) {
|
||||
fileInput.files = files;
|
||||
showFileInfo(files[0]);
|
||||
}
|
||||
});
|
||||
|
||||
// 파일 선택 이벤트
|
||||
fileInput.addEventListener('change', (e) => {
|
||||
if (e.target.files.length > 0) {
|
||||
showFileInfo(e.target.files[0]);
|
||||
}
|
||||
});
|
||||
|
||||
// 파일 정보 표시
|
||||
function showFileInfo(file) {
|
||||
document.getElementById('fileName').textContent = file.name;
|
||||
document.getElementById('fileSize').textContent = formatFileSize(file.size);
|
||||
fileInfo.classList.remove('hidden');
|
||||
uploadBtn.disabled = false;
|
||||
document.getElementById('uploadBtnText').textContent = '협의록 생성하기';
|
||||
}
|
||||
|
||||
// 파일 크기 포맷
|
||||
function formatFileSize(bytes) {
|
||||
if (bytes < 1024) return bytes + ' B';
|
||||
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
|
||||
return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
|
||||
}
|
||||
|
||||
// 파일 클리어
|
||||
function clearFile() {
|
||||
fileInput.value = '';
|
||||
fileInfo.classList.add('hidden');
|
||||
uploadBtn.disabled = true;
|
||||
document.getElementById('uploadBtnText').textContent = '파일을 선택해주세요';
|
||||
}
|
||||
|
||||
// 폼 리셋
|
||||
function resetForm() {
|
||||
clearFile();
|
||||
document.getElementById('titleInput').value = '';
|
||||
document.getElementById('resultSection').classList.add('hidden');
|
||||
document.getElementById('processingCard').classList.add('hidden');
|
||||
dropZone.classList.remove('uploading');
|
||||
}
|
||||
|
||||
// 아코디언 토글
|
||||
function toggleAccordion(header) {
|
||||
const content = header.nextElementSibling;
|
||||
const icon = header.querySelector('.accordion-icon');
|
||||
content.classList.toggle('open');
|
||||
icon.classList.toggle('open');
|
||||
}
|
||||
|
||||
// 목록 새로고침
|
||||
async function refreshMeetingList() {
|
||||
try {
|
||||
const response = await fetch('{{ route("api.admin.meeting-logs.index") }}', {
|
||||
headers: {
|
||||
'HX-Request': 'true',
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
}
|
||||
});
|
||||
const html = await response.text();
|
||||
document.getElementById('meetingList').innerHTML = html;
|
||||
} catch (error) {
|
||||
console.error('목록 새로고침 실패:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 폼 제출
|
||||
uploadForm.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
const formData = new FormData(uploadForm);
|
||||
|
||||
// UI 업데이트
|
||||
dropZone.classList.add('uploading');
|
||||
uploadBtn.disabled = true;
|
||||
document.getElementById('uploadBtnText').classList.add('hidden');
|
||||
document.getElementById('uploadBtnSpinner').classList.remove('hidden');
|
||||
document.getElementById('processingCard').classList.remove('hidden');
|
||||
document.getElementById('progressBar').style.width = '10%';
|
||||
document.getElementById('processingStatus').textContent = '파일 업로드 중...';
|
||||
|
||||
try {
|
||||
document.getElementById('progressBar').style.width = '30%';
|
||||
document.getElementById('processingStatus').textContent = '음성 인식 중...';
|
||||
|
||||
const response = await fetch('{{ route("api.admin.meeting-logs.upload") }}', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
},
|
||||
body: formData
|
||||
});
|
||||
|
||||
document.getElementById('progressBar').style.width = '90%';
|
||||
document.getElementById('processingStatus').textContent = 'AI 협의록 생성 중...';
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
document.getElementById('progressBar').style.width = '100%';
|
||||
|
||||
if (result.success) {
|
||||
showResult(result.data);
|
||||
showToast('업무협의록이 생성되었습니다.', 'success');
|
||||
} else {
|
||||
throw new Error(result.message || '처리 실패');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('업로드 실패:', error);
|
||||
showToast('처리 중 오류가 발생했습니다: ' + error.message, 'error');
|
||||
resetUploadUI();
|
||||
}
|
||||
});
|
||||
|
||||
// 업로드 UI 리셋
|
||||
function resetUploadUI() {
|
||||
dropZone.classList.remove('uploading');
|
||||
uploadBtn.disabled = false;
|
||||
document.getElementById('uploadBtnText').classList.remove('hidden');
|
||||
document.getElementById('uploadBtnSpinner').classList.add('hidden');
|
||||
document.getElementById('processingCard').classList.add('hidden');
|
||||
}
|
||||
|
||||
// 결과 표시
|
||||
function showResult(meeting) {
|
||||
document.getElementById('summaryContent').innerHTML = marked.parse(meeting.summary_text || '요약 내용이 없습니다.');
|
||||
document.getElementById('transcriptContent').textContent = meeting.transcript_text || '';
|
||||
|
||||
document.getElementById('processingCard').classList.add('hidden');
|
||||
document.getElementById('resultSection').classList.remove('hidden');
|
||||
resetUploadUI();
|
||||
|
||||
// 목록 새로고침
|
||||
refreshMeetingList();
|
||||
}
|
||||
|
||||
// 협의록 삭제
|
||||
async function deleteMeeting(id) {
|
||||
showDeleteConfirm('이 협의록', async () => {
|
||||
try {
|
||||
const response = await fetch(`/api/meeting-logs/${id}`, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
}
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
if (result.success) {
|
||||
showToast('삭제되었습니다.', 'success');
|
||||
refreshMeetingList();
|
||||
} else {
|
||||
showToast(result.message || '삭제 실패', 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('삭제 실패:', error);
|
||||
showToast('삭제 중 오류가 발생했습니다.', 'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 협의록 상세 보기
|
||||
async function viewMeeting(id) {
|
||||
try {
|
||||
const response = await fetch(`/api/meeting-logs/${id}/summary`, {
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
||||
}
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
if (result.success) {
|
||||
document.getElementById('summaryContent').innerHTML = marked.parse(result.data.summary || '요약 내용이 없습니다.');
|
||||
document.getElementById('transcriptContent').textContent = result.data.transcript || '';
|
||||
document.getElementById('resultSection').classList.remove('hidden');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('조회 실패:', error);
|
||||
showToast('조회 중 오류가 발생했습니다.', 'error');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{{-- Markdown 파서 --}}
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user