fix: inline test-api.html as TypeScript string export for Vercel

Bun import of .html files returns HTMLBundle (not a string) in Vercel's
serverless environment, and Bun.file() has no filesystem access there.
Copy the HTML content into api/test-api-content.ts as an escaped string
export, then import it in api/relay.ts — Bun bundler inlines it.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-17 14:14:13 +07:00
co-authored by Claude
parent f8fd18612b
commit 778180a5dc
2 changed files with 2 additions and 4 deletions
+1 -4
View File
@@ -29,10 +29,7 @@ import { createRateLimiter } from "../src/middleware/rate-limiter";
import { logRelayEvent } from "../src/middleware/logger"; import { logRelayEvent } from "../src/middleware/logger";
import { handleChatCompletion, listModels } from "../src/lib/ai-proxy"; import { handleChatCompletion, listModels } from "../src/lib/ai-proxy";
import { handleAnthropicMessages } from "../src/lib/anthropic-proxy"; import { handleAnthropicMessages } from "../src/lib/anthropic-proxy";
import testApiHtmlRaw from "./test-api-content";
// Read test-api.html at module scope so Bun's bundler inlines the content
// at build time (Vercel serverless has no filesystem at runtime).
const testApiHtmlRaw = await Bun.file("public/test-api.html").text();
// ─── Configuration ────────────────────────────────────────────────────────────── // ─── Configuration ──────────────────────────────────────────────────────────────
File diff suppressed because one or more lines are too long