4f5fde34a3
- New visual identity: solid dark cards, purple accent, iOS-like feel - Session replay: newest messages first, message input with send button - Chat proxy route for sending messages to sessions - systemd user service with deploy script - All pages restyled: Pulse, Memory, History, Skills, Cron, Soul, Config
23 lines
753 B
TypeScript
23 lines
753 B
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
|
|
const BACKEND = process.env.HERMES_BACKEND_URL || "http://127.0.0.1:8643";
|
|
|
|
export async function POST(req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
|
const { id } = await params;
|
|
const body = await req.json();
|
|
try {
|
|
const res = await fetch(BACKEND + "/api/sessions/" + id + "/chat", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify(body),
|
|
});
|
|
const data = await res.text();
|
|
return new NextResponse(data, {
|
|
status: res.status,
|
|
headers: { "content-type": "application/json" },
|
|
});
|
|
} catch {
|
|
return NextResponse.json({ error: "backend unreachable" }, { status: 502 });
|
|
}
|
|
}
|