- 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>
19 lines
552 B
TypeScript
19 lines
552 B
TypeScript
import type { Env } from '../types';
|
|
|
|
const DEFAULT_OPENAI_GATEWAY = 'https://gateway.ai.cloudflare.com/v1/d8e5997eb4040f8b489f09095c0f623c/telegram-ai-support/openai';
|
|
/**
|
|
* OpenAI Chat Completions API URL (AI Gateway 경유)
|
|
*/
|
|
export function getOpenAIUrl(env: Env): string {
|
|
const base = env.OPENAI_API_BASE || DEFAULT_OPENAI_GATEWAY;
|
|
return `${base}/chat/completions`;
|
|
}
|
|
|
|
/**
|
|
* OpenAI API base URL (chat/completions 제외)
|
|
*/
|
|
export function getOpenAIBaseUrl(env: Env): string {
|
|
return env.OPENAI_API_BASE || DEFAULT_OPENAI_GATEWAY;
|
|
}
|
|
|