Replace D2 rendering with DiagramAgent (Mermaid + Kroki)

- Delete d2-tool.ts and D2_RENDER_URL references
- Add diagram-agent.ts: OpenAI generates Mermaid → Kroki renders PNG → Telegram sendPhoto + R2 cache
- Update onboarding-agent to use generate_diagram tool with DiagramAgent
- Switch wrangler.toml from D2_RENDER_URL to KROKI_URL
- Remove D2 from env-validation, api-urls, tools/index

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-02-12 09:32:46 +09:00
parent 25e56d3f58
commit 7dda198f47
7 changed files with 258 additions and 168 deletions

View File

@@ -9,8 +9,8 @@ binding = "AI"
ENVIRONMENT = "production"
# AI Gateway 경유
OPENAI_API_BASE = "https://gateway.ai.cloudflare.com/v1/d8e5997eb4040f8b489f09095c0f623c/telegram-ai-support/openai"
# D2 렌더링 서비스 (jp1 Incus)
D2_RENDER_URL = "http://10.253.100.107:8080"
# Kroki 다이어그램 서비스 (Mermaid/D2 등 → HAProxy)
KROKI_URL = "https://kroki.anvil.it.com"
# 외부 API
NAMECHEAP_API_URL = "https://namecheap-api.anvil.it.com"
WHOIS_API_URL = "https://whois-api-kappa-inoutercoms-projects.vercel.app"
@@ -58,6 +58,17 @@ index_name = "knowledge-embeddings"
[triggers]
crons = ["0 15 * * *", "*/5 * * * *", "0 * * * *"]
# Cloudflare Queues: 태그 기반 범용 비동기 작업 큐
[[queues.producers]]
queue = "work-queue"
binding = "WORK_QUEUE"
[[queues.consumers]]
queue = "work-queue"
max_batch_size = 1
max_retries = 2
dead_letter_queue = "work-queue-dlq"
# Secrets (wrangler secret put):
# - BOT_TOKEN: Telegram Bot Token
# - WEBHOOK_SECRET: Webhook 검증용 시크릿