mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 11:32:13 +01:00
feat: Implement structured message parsing and display in MessageViewer component
- Added MessageViewer component to display parsed messages in a chat-like format. - Introduced new Message table in the database to store individual messages with timestamps, roles, and content. - Updated Session model to include a relation to parsed messages. - Created transcript parsing logic to convert raw transcripts into structured messages. - Enhanced processing scheduler to handle sessions with parsed messages. - Updated API endpoints to return parsed messages alongside session details. - Added manual trigger commands for session refresh, transcript parsing, and processing. - Improved user experience with color-coded message roles and timestamps in the UI. - Documented the new scheduler workflow and transcript parsing implementation.
This commit is contained in:
@ -19,6 +19,11 @@ export default async function handler(
|
||||
try {
|
||||
const prismaSession = await prisma.session.findUnique({
|
||||
where: { id },
|
||||
include: {
|
||||
messages: {
|
||||
orderBy: { order: 'asc' }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!prismaSession) {
|
||||
@ -55,10 +60,18 @@ export default async function handler(
|
||||
tokensEur: prismaSession.tokensEur ?? undefined,
|
||||
initialMsg: prismaSession.initialMsg ?? undefined,
|
||||
fullTranscriptUrl: prismaSession.fullTranscriptUrl ?? null,
|
||||
transcriptContent: prismaSession.transcriptContent ?? null,
|
||||
processed: prismaSession.processed ?? null, // New field
|
||||
questions: prismaSession.questions ?? null, // New field
|
||||
summary: prismaSession.summary ?? null, // New field
|
||||
messages: prismaSession.messages?.map(msg => ({
|
||||
id: msg.id,
|
||||
sessionId: msg.sessionId,
|
||||
timestamp: new Date(msg.timestamp),
|
||||
role: msg.role,
|
||||
content: msg.content,
|
||||
order: msg.order,
|
||||
createdAt: new Date(msg.createdAt)
|
||||
})) ?? [], // New field - parsed messages
|
||||
};
|
||||
|
||||
return res.status(200).json({ session });
|
||||
|
||||
Reference in New Issue
Block a user