feat:시스템 알림 AI 분석용 복사 버튼 추가
- StatAlert 모델에 ai_analysis_summary accessor 추가 - 알림 상세 아코디언에 'AI 분석용 복사' 버튼 추가 - 클립보드 복사 시 심각도/도메인/유형/메시지 등 포맷팅 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -67,4 +67,36 @@ public function getDomainLabelAttribute(): string
|
||||
default => $this->domain,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* AI 분석용 요약 텍스트
|
||||
*/
|
||||
public function getAiAnalysisSummaryAttribute(): string
|
||||
{
|
||||
$lines = [];
|
||||
$lines[] = "=== SAM 시스템 알림 분석 요청 ===";
|
||||
$lines[] = "";
|
||||
$lines[] = "■ 심각도: {$this->severity} ({$this->severity_label})";
|
||||
$lines[] = "■ 도메인: {$this->domain} ({$this->domain_label})";
|
||||
$lines[] = "■ 알림 유형: {$this->alert_type}";
|
||||
$lines[] = "■ 제목: {$this->title}";
|
||||
$lines[] = "■ 발생 시간: {$this->created_at?->format('Y-m-d H:i:s')}";
|
||||
|
||||
if ($this->message) {
|
||||
$lines[] = "";
|
||||
$lines[] = "■ 상세 메시지:";
|
||||
$lines[] = $this->message;
|
||||
}
|
||||
|
||||
if ($this->current_value || $this->threshold_value) {
|
||||
$lines[] = "";
|
||||
$lines[] = "■ 현재값: {$this->current_value}";
|
||||
$lines[] = "■ 임계값: {$this->threshold_value}";
|
||||
}
|
||||
|
||||
$lines[] = "";
|
||||
$lines[] = "위 시스템 알림의 원인과 해결 방법을 분석해주세요.";
|
||||
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
}
|
||||
@@ -169,9 +169,18 @@ class="text-green-600 hover:text-green-800 text-xs">
|
||||
<tr id="detail-{{ $alert->id }}" class="hidden">
|
||||
<td colspan="7" class="px-4 py-4 bg-slate-50 border-t border-b border-slate-200">
|
||||
<div class="text-sm text-gray-700">
|
||||
<div class="mb-2">
|
||||
<span class="font-medium text-gray-500">유형:</span>
|
||||
{{ $alert->alert_type }}
|
||||
<div class="mb-2 flex items-center justify-between">
|
||||
<div>
|
||||
<span class="font-medium text-gray-500">유형:</span>
|
||||
{{ $alert->alert_type }}
|
||||
</div>
|
||||
<button onclick="event.stopPropagation(); copyAiAnalysis({{ $alert->id }})"
|
||||
class="inline-flex items-center gap-1 px-3 py-1.5 bg-purple-600 hover:bg-purple-700 text-white text-xs rounded-lg transition">
|
||||
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
||||
</svg>
|
||||
AI 분석용 복사
|
||||
</button>
|
||||
</div>
|
||||
@if($alert->message)
|
||||
<div class="mb-2">
|
||||
@@ -206,6 +215,11 @@ class="text-green-600 hover:text-green-800 text-xs">
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<!-- AI 분석용 데이터 -->
|
||||
@foreach($alerts as $alert)
|
||||
<textarea id="ai-analysis-{{ $alert->id }}" class="hidden">{{ $alert->ai_analysis_summary }}</textarea>
|
||||
@endforeach
|
||||
|
||||
<script>
|
||||
function toggleDetail(id) {
|
||||
const detail = document.getElementById('detail-' + id);
|
||||
@@ -213,5 +227,17 @@ function toggleDetail(id) {
|
||||
detail.classList.toggle('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
function copyAiAnalysis(id) {
|
||||
const textarea = document.getElementById('ai-analysis-' + id);
|
||||
if (textarea) {
|
||||
navigator.clipboard.writeText(textarea.value).then(() => {
|
||||
alert('AI 분석용 내용이 클립보드에 복사되었습니다.\nClaude나 ChatGPT에 붙여넣기 하세요.');
|
||||
}).catch(err => {
|
||||
console.error('복사 실패:', err);
|
||||
alert('복사에 실패했습니다.');
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user