mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 21:32:08 +01:00
Broken shit
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
// Script to check what's in the transcript files
|
||||
// Usage: node scripts/check-transcript-content.js
|
||||
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import fetch from 'node-fetch';
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import fetch from "node-fetch";
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
@ -11,10 +11,7 @@ async function checkTranscriptContent() {
|
||||
// Get a few sessions without messages
|
||||
const sessions = await prisma.session.findMany({
|
||||
where: {
|
||||
AND: [
|
||||
{ fullTranscriptUrl: { not: null } },
|
||||
{ messages: { none: {} } },
|
||||
]
|
||||
AND: [{ fullTranscriptUrl: { not: null } }, { messages: { none: {} } }],
|
||||
},
|
||||
include: { company: true },
|
||||
take: 3,
|
||||
@ -25,9 +22,13 @@ async function checkTranscriptContent() {
|
||||
console.log(` URL: ${session.fullTranscriptUrl}`);
|
||||
|
||||
try {
|
||||
const authHeader = session.company.csvUsername && session.company.csvPassword
|
||||
? "Basic " + Buffer.from(`${session.company.csvUsername}:${session.company.csvPassword}`).toString("base64")
|
||||
: undefined;
|
||||
const authHeader =
|
||||
session.company.csvUsername && session.company.csvPassword
|
||||
? "Basic " +
|
||||
Buffer.from(
|
||||
`${session.company.csvUsername}:${session.company.csvPassword}`
|
||||
).toString("base64")
|
||||
: undefined;
|
||||
|
||||
const response = await fetch(session.fullTranscriptUrl, {
|
||||
headers: authHeader ? { Authorization: authHeader } : {},
|
||||
@ -47,24 +48,26 @@ async function checkTranscriptContent() {
|
||||
} else if (content.length < 100) {
|
||||
console.log(` 📝 Full content: "${content}"`);
|
||||
} else {
|
||||
console.log(` 📝 First 200 chars: "${content.substring(0, 200)}..."`);
|
||||
console.log(
|
||||
` 📝 First 200 chars: "${content.substring(0, 200)}..."`
|
||||
);
|
||||
}
|
||||
|
||||
// Check if it matches our expected format
|
||||
const lines = content.split('\n').filter(line => line.trim());
|
||||
const formatMatches = lines.filter(line =>
|
||||
const lines = content.split("\n").filter((line) => line.trim());
|
||||
const formatMatches = lines.filter((line) =>
|
||||
line.match(/^\[([^\]]+)\]\s*([^:]+):\s*(.+)$/)
|
||||
);
|
||||
|
||||
console.log(` 🔍 Lines total: ${lines.length}, Format matches: ${formatMatches.length}`);
|
||||
|
||||
console.log(
|
||||
` 🔍 Lines total: ${lines.length}, Format matches: ${formatMatches.length}`
|
||||
);
|
||||
} catch (error) {
|
||||
console.log(` ❌ Error: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Error:', error);
|
||||
console.error("❌ Error:", error);
|
||||
} finally {
|
||||
await prisma.$disconnect();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user