feat: QR 토큰 품목 상세 전송 지원 (items 파라미터)

This commit is contained in:
thug0bin
2026-03-29 12:37:36 +09:00
parent 3871154509
commit 21e1c3adfa
13 changed files with 3955 additions and 52 deletions

View File

@@ -1555,7 +1555,7 @@ def paai_analyze():
# 5. Clawdbot AI 호출 (WebSocket)
ai_start = time_module.time()
ai_response = call_clawdbot_ai(ai_prompt)
ai_response = call_clawdbot_ai(ai_prompt, cus_code=cus_code)
ai_time = int((time_module.time() - ai_start) * 1000)
# AI 결과 로그 업데이트
@@ -1744,21 +1744,32 @@ def build_paai_prompt(
return prompt
def call_clawdbot_ai(prompt: str) -> dict:
"""Clawdbot AI 호출 (WebSocket Gateway)"""
def call_clawdbot_ai(prompt: str, cus_code: str = None) -> dict:
"""Clawdbot AI 호출 (WebSocket Gateway)
Args:
prompt: AI에게 보낼 프롬프트
cus_code: 환자 코드 (세션 분리용, 같은 날 같은 환자는 세션 공유)
"""
import json
import re
from datetime import datetime
from services.clawdbot_client import ask_clawdbot
PAAI_SYSTEM_PROMPT = """당신은 경험 많은 약사입니다.
처방 데이터를 분석하여 약사에게 유용한 정보를 제공합니다.
이전 대화와 관계없이, 아래 제공된 처방 정보만 보고 독립적으로 분석하세요.
반드시 요청된 JSON 형식으로만 응답하세요."""
# 세션 ID: 날짜별 단일 세션 (하루 1개)
today = datetime.now().strftime('%Y%m%d')
session_id = f'paai-{today}'
try:
# Clawdbot Gateway WebSocket API 호출
ai_text = ask_clawdbot(
message=prompt,
session_id='paai-analysis',
session_id=session_id,
system_prompt=PAAI_SYSTEM_PROMPT,
timeout=60,
model='anthropic/claude-sonnet-4-5' # 빠른 Sonnet 사용