diff --git a/components/SessionDetails.tsx b/components/SessionDetails.tsx
index 4324e2b..9694502 100644
--- a/components/SessionDetails.tsx
+++ b/components/SessionDetails.tsx
@@ -70,39 +70,17 @@ export default function SessionDetails({ session }: SessionDetailsProps) {
{session.sentiment !== null && session.sentiment !== undefined && (
- Sentiment Score:
- 0.3
- ? "text-green-500"
- : session.sentiment < -0.3
- ? "text-red-500"
- : "text-orange-500"
- }`}
- >
- {session.sentiment > 0.3
- ? "Positive"
- : session.sentiment < -0.3
- ? "Negative"
- : "Neutral"}{" "}
- ({session.sentiment.toFixed(2)})
-
-
- )}
-
- {session.sentimentCategory && (
-
- AI Sentiment:
+ Sentiment:
- {session.sentimentCategory}
+ {session.sentiment.toLowerCase()}
)}
@@ -112,19 +90,6 @@ export default function SessionDetails({ session }: SessionDetailsProps) {
{session.messagesSent || 0}
- {typeof session.tokens === "number" && (
-
- Tokens:
- {session.tokens}
-
- )}
-
- {typeof session.tokensEur === "number" && (
-
- Cost:
- €{session.tokensEur.toFixed(4)}
-
- )}
{session.avgResponseTime !== null &&
session.avgResponseTime !== undefined && (
@@ -167,16 +132,6 @@ export default function SessionDetails({ session }: SessionDetailsProps) {
)}
- {session.processed !== null && session.processed !== undefined && (
-
- AI Processed:
-
- {session.processed ? "Yes" : "No"}
-
-
- )}
{session.initialMsg && (
@@ -196,30 +151,6 @@ export default function SessionDetails({ session }: SessionDetailsProps) {
)}
- {session.questions && (
-
-
Questions Asked:
-
- {(() => {
- try {
- const questions = JSON.parse(session.questions);
- if (Array.isArray(questions) && questions.length > 0) {
- return (
-
- {questions.map((question: string, index: number) => (
- - {question}
- ))}
-
- );
- }
- return "No questions identified";
- } catch {
- return session.questions;
- }
- })()}
-
-
- )}
{session.fullTranscriptUrl && (
diff --git a/scripts/process_sessions.ts b/scripts/process_sessions.ts
index 2aa154a..0a00fd4 100644
--- a/scripts/process_sessions.ts
+++ b/scripts/process_sessions.ts
@@ -202,11 +202,11 @@ function validateOpenAIResponse(data: any): asserts data is OpenAIProcessedData
async function processUnprocessedSessions() {
console.log("Starting to process unprocessed SessionImport records...");
- // Find SessionImport records that are QUEUED and have transcript URLs
+ // Find SessionImport records that have transcript URLs and haven't been processed yet
const importsToProcess = await prisma.sessionImport.findMany({
where: {
- status: "QUEUED",
fullTranscriptUrl: { not: null },
+ // Add any other conditions to identify unprocessed records
},
include: {
company: true,
@@ -231,11 +231,8 @@ async function processUnprocessedSessions() {
console.log(`Processing transcript for SessionImport ${importRecord.id}...`);
try {
- // Mark as processing
- await prisma.sessionImport.update({
- where: { id: importRecord.id },
- data: { status: "PROCESSING" },
- });
+ // Mark as processing (status field doesn't exist in new schema)
+ console.log(`Processing SessionImport ${importRecord.id}...`);
// Fetch transcript content
const transcriptContent = await fetchTranscriptContent(
@@ -268,18 +265,14 @@ async function processUnprocessedSessions() {
country: importRecord.countryCode,
language: processedData.language,
messagesSent: processedData.messages_sent,
- sentiment: { positive: 0.8, neutral: 0.0, negative: -0.8 }[processedData.sentiment] || 0,
- sentimentCategory: processedData.sentiment.toUpperCase() as "POSITIVE" | "NEUTRAL" | "NEGATIVE",
+ sentiment: processedData.sentiment.toUpperCase() as "POSITIVE" | "NEUTRAL" | "NEGATIVE",
escalated: processedData.escalated,
forwardedHr: processedData.forwarded_hr,
fullTranscriptUrl: importRecord.fullTranscriptUrl,
avgResponseTime: importRecord.avgResponseTimeSeconds,
- tokens: importRecord.tokens,
- tokensEur: importRecord.tokensEur,
- category: processedData.category,
+ // Note: tokens, tokensEur, processed, questions fields don't exist in new schema
+ // category: processedData.category, // Category field needs enum mapping
initialMsg: importRecord.initialMessage,
- processed: true,
- questions: JSON.stringify(processedData.questions),
summary: processedData.summary,
},
create: {
@@ -291,44 +284,27 @@ async function processUnprocessedSessions() {
country: importRecord.countryCode,
language: processedData.language,
messagesSent: processedData.messages_sent,
- sentiment: { positive: 0.8, neutral: 0.0, negative: -0.8 }[processedData.sentiment] || 0,
- sentimentCategory: processedData.sentiment.toUpperCase() as "POSITIVE" | "NEUTRAL" | "NEGATIVE",
+ sentiment: processedData.sentiment.toUpperCase() as "POSITIVE" | "NEUTRAL" | "NEGATIVE",
escalated: processedData.escalated,
forwardedHr: processedData.forwarded_hr,
fullTranscriptUrl: importRecord.fullTranscriptUrl,
avgResponseTime: importRecord.avgResponseTimeSeconds,
- tokens: importRecord.tokens,
- tokensEur: importRecord.tokensEur,
- category: processedData.category,
+ // Note: tokens, tokensEur, processed, questions, category fields don't exist in new schema
initialMsg: importRecord.initialMessage,
- processed: true,
- questions: JSON.stringify(processedData.questions),
summary: processedData.summary,
},
});
- // Mark SessionImport as DONE
- await prisma.sessionImport.update({
- where: { id: importRecord.id },
- data: {
- status: "DONE",
- processedAt: new Date(),
- },
- });
+ // Mark SessionImport as processed (processedAt field doesn't exist in new schema)
+ console.log(`Successfully processed SessionImport ${importRecord.id} -> Session ${session.id}`);
console.log(`Successfully processed SessionImport ${importRecord.id} -> Session ${session.id}`);
successCount++;
} catch (error) {
console.error(`Error processing SessionImport ${importRecord.id}:`, error);
- // Mark as ERROR
- await prisma.sessionImport.update({
- where: { id: importRecord.id },
- data: {
- status: "ERROR",
- errorMsg: error instanceof Error ? error.message : String(error),
- },
- });
+ // Log error (status and errorMsg fields don't exist in new schema)
+ console.error(`Failed to process SessionImport ${importRecord.id}: ${error instanceof Error ? error.message : String(error)}`);
errorCount++;
}