Initial implementation of Telegram AI customer support bot
Cloudflare Workers + Hono + D1 + KV + R2 stack with 4 specialized AI agents (onboarding, troubleshoot, asset, billing), OpenAI function calling with 7 tool definitions, human escalation, pending action approval workflow, feedback collection, audit logging, i18n (ko/en), and Workers AI fallback. 43 source files, 45 tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
26
src/utils/api-urls.ts
Normal file
26
src/utils/api-urls.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { Env } from '../types';
|
||||
|
||||
const DEFAULT_OPENAI_GATEWAY = 'https://gateway.ai.cloudflare.com/v1/d8e5997eb4040f8b489f09095c0f623c/telegram-ai-support/openai';
|
||||
const DEFAULT_D2_RENDER_URL = 'http://10.253.100.107:8080';
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* D2 diagram rendering service URL
|
||||
*/
|
||||
export function getD2RenderUrl(env: Env): string {
|
||||
return env.D2_RENDER_URL || DEFAULT_D2_RENDER_URL;
|
||||
}
|
||||
Reference in New Issue
Block a user