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:
37
ai-service/routers/chatbot.py
Normal file
37
ai-service/routers/chatbot.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from pydantic import BaseModel
|
||||
from services.chatbot_service import analyze_user_input, summarize_report
|
||||
|
||||
router = APIRouter(tags=["chatbot"])
|
||||
|
||||
|
||||
class AnalyzeRequest(BaseModel):
|
||||
user_text: str
|
||||
categories: dict = {}
|
||||
|
||||
|
||||
class SummarizeRequest(BaseModel):
|
||||
description: str = ""
|
||||
type: str = ""
|
||||
category: str = ""
|
||||
item: str = ""
|
||||
location: str = ""
|
||||
project: str = ""
|
||||
|
||||
|
||||
@router.post("/chatbot/analyze")
|
||||
async def chatbot_analyze(req: AnalyzeRequest):
|
||||
try:
|
||||
result = await analyze_user_input(req.user_text, req.categories)
|
||||
return {"success": True, **result}
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail="AI 분석 중 오류가 발생했습니다")
|
||||
|
||||
|
||||
@router.post("/chatbot/summarize")
|
||||
async def chatbot_summarize(req: SummarizeRequest):
|
||||
try:
|
||||
result = await summarize_report(req.model_dump())
|
||||
return {"success": True, **result}
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=500, detail="AI 요약 중 오류가 발생했습니다")
|
||||
Reference in New Issue
Block a user