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:
MythEclipseandClaude committed 2026-06-17 14:14:13 +07:00
1 parent f8fd18612b
commit 778180a5dc
2 files changed
+2 -4

No files matched your search

+1 -4
View File
@@ -29,10 +29,7 @@ import { createRateLimiter } from "../src/middleware/rate-limiter";
import { logRelayEvent } from "../src/middleware/logger";
import { handleChatCompletion, listModels } from "../src/lib/ai-proxy";
import { handleAnthropicMessages } from "../src/lib/anthropic-proxy";
// 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();
import testApiHtmlRaw from "./test-api-content";
// ─── Configuration ──────────────────────────────────────────────────────────────
+1
View File
@@ -0,0 +1 @@
export default "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Edge Proxy — API Test</title>\n <style>\n *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n body { font-family: system-ui, -apple-system, sans-serif; background: #0d1117; color: #e1e4e8; padding: 1.5rem; }\n main { max-width: 960px; margin: 0 auto; }\n h1 { font-size: 1.5rem; colorLine truncated