mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 08:32:09 +01:00
Adds Markdown rendering to the transcript viewer for enhanced formatting. This change integrates `react-markdown` to parse and render transcript content, allowing for richer text formatting, including links and other Markdown elements. It also adds a toggle to switch between raw and formatted text, and displays a message when transcript content is unavailable. The UI of the transcript viewer has been improved to be more user-friendly with titles and descriptions.
108 lines
2.3 KiB
TypeScript
108 lines
2.3 KiB
TypeScript
import { Session as NextAuthSession } from "next-auth";
|
|
|
|
export interface UserSession extends NextAuthSession {
|
|
user: {
|
|
id?: string;
|
|
name?: string;
|
|
email?: string;
|
|
image?: string;
|
|
companyId: string;
|
|
role: string;
|
|
};
|
|
}
|
|
|
|
export interface Company {
|
|
id: string;
|
|
name: string;
|
|
csvUrl: string;
|
|
csvUsername?: string;
|
|
csvPassword?: string;
|
|
sentimentAlert?: number; // Match Prisma schema naming
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
}
|
|
|
|
export interface User {
|
|
id: string;
|
|
email: string;
|
|
password: string;
|
|
role: string;
|
|
companyId: string;
|
|
resetToken?: string | null;
|
|
resetTokenExpiry?: Date | null;
|
|
company?: Company;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
}
|
|
|
|
export interface ChatSession {
|
|
id: string;
|
|
sessionId: string;
|
|
companyId: string;
|
|
userId?: string | null;
|
|
category?: string | null;
|
|
language?: string | null;
|
|
country?: string | null;
|
|
ipAddress?: string | null;
|
|
sentiment?: number | null;
|
|
messagesSent?: number;
|
|
startTime: Date;
|
|
endTime?: Date | null;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
|
|
// Extended session properties that might be used in metrics
|
|
avgResponseTime?: number | null;
|
|
escalated?: boolean;
|
|
forwardedHr?: boolean;
|
|
tokens?: number;
|
|
tokensEur?: number;
|
|
initialMsg?: string;
|
|
fullTranscriptUrl?: string | null;
|
|
transcriptContent?: string | null;
|
|
}
|
|
|
|
export interface DayMetrics {
|
|
[day: string]: number;
|
|
}
|
|
|
|
export interface CategoryMetrics {
|
|
[category: string]: number;
|
|
}
|
|
|
|
export interface LanguageMetrics {
|
|
[language: string]: number;
|
|
}
|
|
|
|
export interface MetricsResult {
|
|
totalSessions: number;
|
|
avgSessionsPerDay: number;
|
|
avgSessionLength: number | null;
|
|
days: DayMetrics;
|
|
languages: LanguageMetrics;
|
|
categories: CategoryMetrics;
|
|
belowThresholdCount: number;
|
|
// Additional properties for dashboard
|
|
escalatedCount?: number;
|
|
forwardedCount?: number;
|
|
avgSentiment?: number;
|
|
avgResponseTime?: number;
|
|
totalTokens?: number;
|
|
totalTokensEur?: number;
|
|
sentimentThreshold?: number | null;
|
|
lastUpdated?: number; // Timestamp for when metrics were last updated
|
|
|
|
// New metrics for enhanced dashboard
|
|
sentimentPositiveCount?: number;
|
|
sentimentNeutralCount?: number;
|
|
sentimentNegativeCount?: number;
|
|
tokensByDay?: DayMetrics;
|
|
tokensCostByDay?: DayMetrics;
|
|
}
|
|
|
|
export interface ApiResponse<T> {
|
|
success: boolean;
|
|
data?: T;
|
|
error?: string;
|
|
}
|