docs: add AI Gateway, CLI test client, and WEBHOOK_SECRET documentation
- Add Cloudflare AI Gateway section (regional restriction bypass) - Add CLI test client usage (npm run chat) - Document WEBHOOK_SECRET configuration Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
33
CLAUDE.md
33
CLAUDE.md
@@ -64,6 +64,19 @@ npm run deploy # Cloudflare Workers 배포
|
|||||||
npm run db:init # D1 스키마 초기화 (production) ⚠️ 주의
|
npm run db:init # D1 스키마 초기화 (production) ⚠️ 주의
|
||||||
npm run db:init:local # D1 스키마 초기화 (local)
|
npm run db:init:local # D1 스키마 초기화 (local)
|
||||||
npm run tail # Workers 로그 스트리밍
|
npm run tail # Workers 로그 스트리밍
|
||||||
|
npm run chat # CLI 테스트 클라이언트
|
||||||
|
```
|
||||||
|
|
||||||
|
**CLI 테스트 클라이언트:**
|
||||||
|
```bash
|
||||||
|
# 환경변수 설정
|
||||||
|
export WEBHOOK_SECRET="..." # Vault: secret/data/telegram-bot
|
||||||
|
|
||||||
|
# 대화형 모드
|
||||||
|
npm run chat
|
||||||
|
|
||||||
|
# 단일 메시지 모드
|
||||||
|
npm run chat "날씨 알려줘"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Secrets 설정:**
|
**Secrets 설정:**
|
||||||
@@ -362,6 +375,7 @@ curl -X POST 'https://api.openai.com/v1/assistants/asst_XMoVGU7ZwRpUPI6PHGvRNm8E
|
|||||||
| `DOMAIN_OWNER_ID` | - | 도메인 관리 권한 Telegram ID |
|
| `DOMAIN_OWNER_ID` | - | 도메인 관리 권한 Telegram ID |
|
||||||
| `DEPOSIT_AGENT_ID` | - | 예치금 관리 Assistant ID |
|
| `DEPOSIT_AGENT_ID` | - | 예치금 관리 Assistant ID |
|
||||||
| `DEPOSIT_ADMIN_ID` | - | 예치금 관리 권한 Telegram ID |
|
| `DEPOSIT_ADMIN_ID` | - | 예치금 관리 권한 Telegram ID |
|
||||||
|
| `WEBHOOK_SECRET` | - | Telegram Webhook 인증 (wrangler secret, Vault: telegram-bot) |
|
||||||
| `BANK_API_SECRET` | - | 입금 알림 API 인증 키 (wrangler secret) |
|
| `BANK_API_SECRET` | - | 입금 알림 API 인증 키 (wrangler secret) |
|
||||||
| `BRAVE_API_KEY` | - | Brave Search API 키 (wrangler secret) |
|
| `BRAVE_API_KEY` | - | Brave Search API 키 (wrangler secret) |
|
||||||
| `DEPOSIT_API_SECRET` | - | Deposit API 인증 키 (namecheap-api용, wrangler secret) |
|
| `DEPOSIT_API_SECRET` | - | Deposit API 인증 키 (namecheap-api용, wrangler secret) |
|
||||||
@@ -372,8 +386,9 @@ curl -X POST 'https://api.openai.com/v1/assistants/asst_XMoVGU7ZwRpUPI6PHGvRNm8E
|
|||||||
|
|
||||||
| 서비스 | 용도 | 엔드포인트 | 주의사항 |
|
| 서비스 | 용도 | 엔드포인트 | 주의사항 |
|
||||||
|--------|------|-----------|----------|
|
|--------|------|-----------|----------|
|
||||||
|
| **AI Gateway** | OpenAI 프록시 | gateway.ai.cloudflare.com | 지역 제한 우회, 로그/캐시 |
|
||||||
| Context7 | 문서 조회 | context7.com API | - |
|
| Context7 | 문서 조회 | context7.com API | - |
|
||||||
| Deposit Agent | 예치금 관리 | OpenAI Assistants | `asst_XMoVGU7ZwRpUPI6PHGvRNm8E` |
|
| Deposit Agent | 예치금 관리 | OpenAI Assistants (직접) | `asst_XMoVGU7ZwRpUPI6PHGvRNm8E` |
|
||||||
| Namecheap API | 도메인 백엔드 | namecheap-api.anvil.it.com | 날짜: MM/DD/YYYY → ISO 변환 |
|
| Namecheap API | 도메인 백엔드 | namecheap-api.anvil.it.com | 날짜: MM/DD/YYYY → ISO 변환 |
|
||||||
| WHOIS API | WHOIS 조회 | whois-api-eight.vercel.app | ccSLD 미지원 |
|
| WHOIS API | WHOIS 조회 | whois-api-eight.vercel.app | ccSLD 미지원 |
|
||||||
| wttr.in | 날씨 | wttr.in | - |
|
| wttr.in | 날씨 | wttr.in | - |
|
||||||
@@ -382,6 +397,22 @@ curl -X POST 'https://api.openai.com/v1/assistants/asst_XMoVGU7ZwRpUPI6PHGvRNm8E
|
|||||||
| Gmail | 입금 SMS 수신 | deposit.anvil@gmail.com | Apps Script 연동 |
|
| Gmail | 입금 SMS 수신 | deposit.anvil@gmail.com | Apps Script 연동 |
|
||||||
| Apps Script | Gmail → Worker 연동 | script.google.com | 1분마다 실행, message_id 중복 방지 |
|
| Apps Script | Gmail → Worker 연동 | script.google.com | 1분마다 실행, message_id 중복 방지 |
|
||||||
|
|
||||||
|
### Cloudflare AI Gateway
|
||||||
|
|
||||||
|
OpenAI API 호출을 Cloudflare AI Gateway를 통해 프록시하여 지역 제한 우회
|
||||||
|
|
||||||
|
```
|
||||||
|
Gateway ID: telegram-bot
|
||||||
|
Account ID: d8e5997eb4040f8b489f09095c0f623c
|
||||||
|
URL: gateway.ai.cloudflare.com/v1/{account_id}/telegram-bot/openai/...
|
||||||
|
```
|
||||||
|
|
||||||
|
**적용 범위:**
|
||||||
|
- ✅ Chat Completions (openai-service.ts) - AI Gateway 경유
|
||||||
|
- ❌ Assistants API (deposit-agent.ts) - 직접 호출 (Gateway 미지원)
|
||||||
|
|
||||||
|
**대시보드:** https://dash.cloudflare.com → AI → AI Gateway → telegram-bot
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Deposit System
|
## Deposit System
|
||||||
|
|||||||
Reference in New Issue
Block a user