moxieTalking/src/app/api/conversations/[id]/messages/route.ts
Z User e4408a63e6 feat: add Echo voice assistant web UI
- Conversation sidebar with create/delete/history
- Chat area with streaming LLM responses (z-ai-web-dev-sdk)
- Voice input via Web Speech API with recording indicator
- Browser TTS auto-speak for assistant responses
- Settings panel (voice, TTS, sidebar toggle)
- Prisma schema: Conversation + Message models
- API routes: /api/chat/stream, /api/conversations, /api/messages
- Zustand store for state management
- Web Speech API type declarations
2026-03-31 00:42:10 +00:00

25 lines
576 B
TypeScript

import { db } from "@/lib/db";
import { NextResponse } from "next/server";
export async function GET(
request: Request,
{ params }: { params: Promise<{ id: string }> }
) {
try {
const { id } = await params;
const messages = await db.message.findMany({
where: { conversationId: id },
orderBy: { createdAt: "asc" },
});
return NextResponse.json(messages);
} catch (error) {
console.error("Failed to fetch messages:", error);
return NextResponse.json(
{ error: "Failed to fetch messages" },
{ status: 500 }
);
}
}