import { NextResponse } from "next/server"; import fs from "fs"; import path from "path"; const DEBUG_FILE = "/tmp/last_gemini.json"; export async function GET() { try { if (fs.existsSync(DEBUG_FILE)) { const raw = fs.readFileSync(DEBUG_FILE, "utf8"); return NextResponse.json({ lastResponse: JSON.parse(raw), }); } } catch (e) { return NextResponse.json({ error: "Failed to read debug file", details: String(e), }); } return NextResponse.json({ lastResponse: "No requests captured on disk yet since last deploy. Send a message from the desktop first.", }); }