feat: 예치금 시스템 추가 (은행 SMS 자동 매칭)
- manage_deposit Function Calling 추가 (잔액조회, 입금신고, 거래내역, 취소) - Email Worker로 은행 SMS 파싱 (하나/KB/신한 지원) - 양방향 자동 매칭: 사용자 신고 ↔ 은행 알림 - D1 테이블: user_deposits, deposit_transactions, bank_notifications - 관리자 전용: 대기목록 조회, 입금 확인/거절 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
30
CLAUDE.md
30
CLAUDE.md
@@ -38,15 +38,19 @@ Telegram Webhook → Security Validation → Command/Message Router
|
||||
```
|
||||
|
||||
**Core Services**:
|
||||
- `openai-service.ts` - GPT-4o-mini + Function Calling (6개 도구: weather, search, time, calculate, lookup_docs, manage_domain)
|
||||
- `openai-service.ts` - GPT-4o-mini + Function Calling (7개 도구: weather, search, time, calculate, lookup_docs, manage_domain, manage_deposit)
|
||||
- `summary-service.ts` - 메시지 버퍼링 + 20개마다 프로필 추출 (슬라이딩 윈도우 3개)
|
||||
- `security.ts` - Webhook 검증 (timing-safe comparison, timestamp validation, rate limiting 30req/min)
|
||||
- `commands.ts` - 봇 명령어 핸들러 (/start, /help, /profile, /reset, /context, /stats, /debug)
|
||||
- `index.ts` - Email Worker 핸들러 (SMS → 메일 파싱, 은행 알림 자동 매칭)
|
||||
|
||||
**Data Layer** (D1 SQLite):
|
||||
- `users` - telegram_id 기반 사용자
|
||||
- `message_buffer` - 롤링 대화 기록
|
||||
- `summaries` - 프로필 버전 관리 (generation 추적)
|
||||
- `user_deposits` - 예치금 계정 (잔액 관리)
|
||||
- `deposit_transactions` - 예치금 거래 내역 (pending/confirmed/rejected)
|
||||
- `bank_notifications` - 은행 SMS 파싱 결과 (자동 매칭용)
|
||||
|
||||
**AI Fallback**: OpenAI 미설정 시 Workers AI (Llama 3.1 8B) 자동 전환
|
||||
|
||||
@@ -65,6 +69,7 @@ Telegram Webhook → Security Validation → Command/Message Router
|
||||
- `MAX_SUMMARIES_PER_USER`: 유지할 프로필 버전 수 (기본 3)
|
||||
- `DOMAIN_AGENT_ID`: OpenAI Assistant ID (도메인 관리 에이전트)
|
||||
- `DOMAIN_OWNER_ID`: 도메인 관리 권한 Telegram ID (소유권 검증용)
|
||||
- `DEPOSIT_ADMIN_ID`: 예치금 관리 권한 Telegram ID (입금 확인/거절)
|
||||
|
||||
## External Integrations
|
||||
|
||||
@@ -74,3 +79,26 @@ Telegram Webhook → Security Validation → Command/Message Router
|
||||
- **wttr.in**: 날씨 API
|
||||
- **DuckDuckGo**: 웹 검색 API
|
||||
- **Vault**: `vault.anvil.it.com`에서 API 키 중앙 관리
|
||||
- **Email Workers**: SMS → 메일 수신 → 은행 알림 파싱 (하나/KB/신한 지원)
|
||||
|
||||
## Deposit System
|
||||
|
||||
**예치금 자동 매칭 흐름**:
|
||||
```
|
||||
[사용자 신고] "홍길동 50000원 입금"
|
||||
↓
|
||||
bank_notifications 테이블 검색 (입금자명 + 금액 매칭)
|
||||
↓
|
||||
매칭 성공 → confirmed | 매칭 실패 → pending 대기
|
||||
|
||||
[은행 SMS 수신] Email Worker
|
||||
↓
|
||||
SMS 파싱 → bank_notifications 저장
|
||||
↓
|
||||
deposit_transactions 검색 (pending 상태 + 입금자명 + 금액)
|
||||
↓
|
||||
매칭 성공 → confirmed + 잔액 증가 | 매칭 실패 → 알림만 저장
|
||||
```
|
||||
|
||||
**입금 계좌**: 하나은행 427-910018-27104 (주식회사 아이언클래드)
|
||||
- Vault 경로: `secret/companies/ironclad-corp`
|
||||
|
||||
Reference in New Issue
Block a user