From 989109352b4ab7833036dd4dfa739ebee75303d2 Mon Sep 17 00:00:00 2001 From: Story Crater Bot <19826264+Riotpiaole@users.noreply.github.com> Date: Tue, 1 Sep 2026 10:31:07 -0700 Subject: [PATCH] refactor: use real api.riotpiao.com in both dev and production --- app/api/chat/route.ts | 41 +---------------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index a96948f..22813ab 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -35,9 +35,8 @@ Pre-screen context: Technical depth for platform engineer role. Cert rotation, q export async function POST(request: NextRequest) { const token = process.env.LLM_API_TOKEN - const isDev = process.env.NODE_ENV === 'development' - if (!token && !isDev) { + if (!token) { return new Response( JSON.stringify({ error: 'LLM_API_TOKEN not configured' }), { status: 500, headers: { 'Content-Type': 'application/json' } } @@ -47,44 +46,6 @@ export async function POST(request: NextRequest) { try { const { message } = await request.json() - // Dev fallback: mock streaming response - if (isDev && !token) { - const encoder = new TextEncoder() - const mockReasoning = `Analyzing "${message}"...` - const mockContent = `Rock has 6+ years experience in Infrastructure, Backend, and LLM Systems. His expertise spans Kubernetes, Terraform, vLLM optimization (60% latency cut), AWS Distributed-Map across 57+ regions, and production homelab with 99.2% uptime.` - - const stream = new ReadableStream({ - async start(controller) { - let reasoning = '' - let content = '' - - // Stream reasoning - for (const char of mockReasoning) { - reasoning += char - controller.enqueue(encoder.encode(`data: ${JSON.stringify({ type: 'reasoning', text: reasoning })}\n\n`)) - await new Promise(r => setTimeout(r, 5)) - } - - // Stream content - for (const char of mockContent) { - content += char - controller.enqueue(encoder.encode(`data: ${JSON.stringify({ type: 'content', text: content })}\n\n`)) - await new Promise(r => setTimeout(r, 10)) - } - - controller.enqueue(encoder.encode(`data: ${JSON.stringify({ type: 'done' })}\n\n`)) - controller.close() - }, - }) - return new Response(stream, { - headers: { - 'Content-Type': 'text/event-stream', - 'Cache-Control': 'no-cache', - 'Connection': 'keep-alive', - }, - }) - } - const response = await fetch(LLM_API_URL, { method: 'POST', headers: {