feat: PAAI (Pharmacist Assistant AI) 기능 구현

- PAAI 로그 테이블 스키마 (paai_logs_schema.sql)
- PAAI 로거 모듈 (db/paai_logger.py)
- /pmr/api/paai/analyze API 엔드포인트
- KIMS API 연동 (KD코드 기반 상호작용 조회)
- Clawdbot AI 연동 (HTTP API)
- PMR 화면 PAAI 버튼 및 모달
- Admin 페이지 (/admin/paai)
- 피드백 수집 기능
This commit is contained in:
thug0bin
2026-03-05 00:36:51 +09:00
parent 141b211f07
commit 1b33f82fd4
6 changed files with 1755 additions and 0 deletions

View File

@@ -6805,6 +6805,65 @@ def api_animal_drug_info_preview():
return jsonify({'success': False, 'error': str(e)}), 500
# ═══════════════════════════════════════════════════════════════════════════════
# PAAI (Pharmacist Assistant AI) Admin 라우트
# ═══════════════════════════════════════════════════════════════════════════════
@app.route('/admin/paai')
def admin_paai():
"""PAAI 분석 로그 관리 페이지"""
return render_template('admin_paai.html')
@app.route('/api/paai/logs')
def api_paai_logs():
"""PAAI 로그 목록 조회"""
from db.paai_logger import get_recent_logs
limit = int(request.args.get('limit', 100))
status = request.args.get('status', '')
has_severe = request.args.get('has_severe', '')
date = request.args.get('date', '')
try:
logs = get_recent_logs(
limit=limit,
status=status if status else None,
has_severe=True if has_severe == 'true' else (False if has_severe == 'false' else None),
date=date if date else None
)
return jsonify({'success': True, 'logs': logs, 'count': len(logs)})
except Exception as e:
return jsonify({'success': False, 'error': str(e)}), 500
@app.route('/api/paai/logs/stats')
def api_paai_logs_stats():
"""PAAI 로그 통계"""
from db.paai_logger import get_stats
try:
stats = get_stats()
return jsonify({'success': True, 'stats': stats})
except Exception as e:
return jsonify({'success': False, 'error': str(e)}), 500
@app.route('/api/paai/logs/<int:log_id>')
def api_paai_log_detail(log_id):
"""PAAI 로그 상세 조회"""
from db.paai_logger import get_log_detail
try:
log = get_log_detail(log_id)
if log:
return jsonify({'success': True, 'log': log})
else:
return jsonify({'success': False, 'error': '로그를 찾을 수 없습니다.'}), 404
except Exception as e:
return jsonify({'success': False, 'error': str(e)}), 500
if __name__ == '__main__':
import os