feat: 챗봇 신고 페이지 AI 백엔드 추가 및 기타 개선

- ai-service: 챗봇 분석/요약 엔드포인트 추가 (chatbot.py, chatbot_service.py)
- tkreport: 챗봇 신고 페이지 (chat-report.html/js/css), nginx ai-api 프록시
- tkreport: 이미지 업로드 서비스 개선, M-Project 연동 신고자 정보 전달
- system1: TBM 작업보고서 UI 개선
- TKQC: 관리함/수신함 기능 개선

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-09 14:11:00 +09:00
parent 5aeda43605
commit d42380ff63
16 changed files with 1522 additions and 59 deletions

View File

@@ -9,6 +9,7 @@
const path = require('path');
const fs = require('fs').promises;
const crypto = require('crypto');
const { execFileSync } = require('child_process');
// sharp는 선택적으로 사용 (설치되어 있지 않으면 리사이징 없이 저장)
let sharp;
@@ -110,6 +111,7 @@ async function saveBase64Image(base64String, prefix = 'issue', category = 'issue
const filepath = path.join(uploadDir, filename);
// sharp가 설치되어 있으면 리사이징 및 최적화
let saved = false;
if (sharp) {
try {
await sharp(buffer)
@@ -119,13 +121,27 @@ async function saveBase64Image(base64String, prefix = 'issue', category = 'issue
})
.jpeg({ quality: QUALITY })
.toFile(filepath);
saved = true;
} catch (sharpError) {
console.error('sharp 처리 실패, 원본 저장:', sharpError.message);
// sharp 실패 시 원본 저장
await fs.writeFile(filepath, buffer);
console.warn('sharp 처리 실패:', sharpError.message);
}
} else {
// sharp가 없으면 원본 그대로 저장
}
// sharp 실패 시 ImageMagick으로 변환 시도 (HEIC 등)
if (!saved) {
try {
const tmpInput = filepath + '.tmp';
await fs.writeFile(tmpInput, buffer);
execFileSync('magick', [tmpInput, '-resize', `${MAX_SIZE.width}x${MAX_SIZE.height}>`, '-quality', String(QUALITY), filepath]);
await fs.unlink(tmpInput).catch(() => {});
saved = true;
} catch (magickError) {
console.warn('ImageMagick 변환 실패:', magickError.message);
}
}
// 모두 실패 시 원본 저장
if (!saved) {
await fs.writeFile(filepath, buffer);
}