mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-25 08:48:13 +02:00
fix: changes to update pipecat version to 0.0.100 (#122)
* feat: add stt evals * add smart turn as provider * chore: remove deprecations * chore: format files * fix: remove deprecated UserIdleProcessor * fix: remove deprecated TranscriptProcessor * chore: update pipecat submodule * feat: add evals visualisation * fix: trigger llm generation on client connected and pipeline started * chore: update pipecat * chore: update pipecat submodule * Add tests * fix: slow loading of workflow page * chore: update pipecat submodule * Show version after release * Fixes #99 * fix: provider check for websocket connection * Fixes #107 * Fix #96 * chore: fix documentation * fix: cloudonix campaign call error --------- Co-authored-by: Sabiha Khan <sabihak89@gmail.com>
This commit is contained in:
parent
a4367bd83b
commit
911c5ed416
104 changed files with 16919 additions and 597 deletions
42
evals/visualizer/src/app/api/audio/[filename]/route.ts
Normal file
42
evals/visualizer/src/app/api/audio/[filename]/route.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import { NextRequest, NextResponse } from "next/server";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
const AUDIO_DIR = path.join(process.cwd(), "..", "stt", "audio");
|
||||
|
||||
const MIME_TYPES: Record<string, string> = {
|
||||
".mp3": "audio/mpeg",
|
||||
".wav": "audio/wav",
|
||||
".m4a": "audio/mp4",
|
||||
".ogg": "audio/ogg",
|
||||
".webm": "audio/webm",
|
||||
};
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: Promise<{ filename: string }> }
|
||||
) {
|
||||
try {
|
||||
const { filename } = await params;
|
||||
const filePath = path.join(AUDIO_DIR, filename);
|
||||
|
||||
if (!fs.existsSync(filePath)) {
|
||||
return NextResponse.json({ error: "Audio file not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const ext = path.extname(filename).toLowerCase();
|
||||
const contentType = MIME_TYPES[ext] || "application/octet-stream";
|
||||
|
||||
const fileBuffer = fs.readFileSync(filePath);
|
||||
|
||||
return new NextResponse(fileBuffer, {
|
||||
headers: {
|
||||
"Content-Type": contentType,
|
||||
"Content-Length": fileBuffer.length.toString(),
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error serving audio:", error);
|
||||
return NextResponse.json({ error: "Failed to serve audio" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
27
evals/visualizer/src/app/api/results/[id]/route.ts
Normal file
27
evals/visualizer/src/app/api/results/[id]/route.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { NextRequest, NextResponse } from "next/server";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
const RESULTS_DIR = path.join(process.cwd(), "..", "stt", "results");
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
try {
|
||||
const { id } = await params;
|
||||
const filePath = path.join(RESULTS_DIR, `${id}.json`);
|
||||
|
||||
if (!fs.existsSync(filePath)) {
|
||||
return NextResponse.json({ error: "Result not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const content = fs.readFileSync(filePath, "utf-8");
|
||||
const data = JSON.parse(content);
|
||||
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
console.error("Error reading result:", error);
|
||||
return NextResponse.json({ error: "Failed to read result" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
47
evals/visualizer/src/app/api/results/route.ts
Normal file
47
evals/visualizer/src/app/api/results/route.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import { NextResponse } from "next/server";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { ResultSummary, EventCaptureResult } from "@/types";
|
||||
|
||||
const RESULTS_DIR = path.join(process.cwd(), "..", "stt", "results");
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
if (!fs.existsSync(RESULTS_DIR)) {
|
||||
return NextResponse.json([]);
|
||||
}
|
||||
|
||||
const files = fs.readdirSync(RESULTS_DIR).filter((f) => f.endsWith(".json"));
|
||||
const results: ResultSummary[] = [];
|
||||
|
||||
for (const file of files) {
|
||||
try {
|
||||
const filePath = path.join(RESULTS_DIR, file);
|
||||
const content = fs.readFileSync(filePath, "utf-8");
|
||||
const data: EventCaptureResult = JSON.parse(content);
|
||||
|
||||
results.push({
|
||||
id: file.replace(".json", ""),
|
||||
audio_file: data.audio_file,
|
||||
provider: data.provider,
|
||||
duration: data.duration,
|
||||
created_at: data.created_at,
|
||||
event_count: data.events.length,
|
||||
});
|
||||
} catch {
|
||||
console.error(`Failed to parse ${file}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort by created_at descending
|
||||
results.sort(
|
||||
(a, b) =>
|
||||
new Date(b.created_at).getTime() - new Date(a.created_at).getTime()
|
||||
);
|
||||
|
||||
return NextResponse.json(results);
|
||||
} catch (error) {
|
||||
console.error("Error reading results:", error);
|
||||
return NextResponse.json({ error: "Failed to read results" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue