feat(agent-office): 텔레그램 자연어 대화 + 프롬프트 캐싱 + 평가 지표
- 슬래시 명령이 아닌 메시지를 Claude Haiku 4.5로 응답 - system 프롬프트 + 히스토리 끝 블록에 cache_control:ephemeral 적용 - conversation_messages 테이블에 토큰·캐시·latency 기록 - chat_id 화이트리스트 + 분당 rate limit - GET /api/agent-office/conversation/stats 로 캐시 히트율·토큰 확인
This commit is contained in:
@@ -69,6 +69,16 @@ async def _handle_message(message: dict, agent_dispatcher) -> Optional[dict]:
|
||||
text = message.get("text", "")
|
||||
parsed = parse_command(text)
|
||||
if not parsed:
|
||||
# 슬래시 명령이 아니면 자연어 대화로 라우팅
|
||||
chat_id = str(message.get("chat", {}).get("id", ""))
|
||||
if not chat_id:
|
||||
return None
|
||||
from .conversational import respond_to_message
|
||||
reply = await respond_to_message(chat_id, text)
|
||||
if reply:
|
||||
import html as _html
|
||||
await send_raw(_html.escape(reply), chat_id=chat_id)
|
||||
return {"handled": "chat"}
|
||||
return None
|
||||
|
||||
agent_id, command, args = parsed
|
||||
|
||||
Reference in New Issue
Block a user