2026-09-01 01:57:13 +03:00
|
|
|
import { getChat, isTurnRunning } from "@/src/server";
|
2026-08-22 02:18:27 +03:00
|
|
|
|
|
|
|
|
export async function GET(_req: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
|
|
|
const { id } = await params;
|
|
|
|
|
const chat = getChat(id);
|
|
|
|
|
if (!chat) return Response.json({ error: "Not found" }, { status: 404 });
|
2026-09-01 01:57:13 +03:00
|
|
|
// turnInFlight lets a returning client re-attach to a running turn
|
|
|
|
|
// (chat-handler write-ahead + registry — see src/server/turn-liveness.ts).
|
|
|
|
|
return Response.json({ ...chat, turnInFlight: isTurnRunning(id) });
|
2026-08-22 02:18:27 +03:00
|
|
|
}
|