Fixed build

This commit is contained in:
Will
2026-03-30 20:10:00 +01:00
parent f7ef64fb69
commit bf96625d40
4 changed files with 13 additions and 2 deletions

8
package-lock.json generated
View File

@@ -16,6 +16,7 @@
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/dom-speech-recognition": "^0.0.8",
"@types/node": "^20.19.37",
"@types/react": "^19",
"@types/react-dom": "^19",
@@ -1622,6 +1623,13 @@
"tslib": "^2.4.0"
}
},
"node_modules/@types/dom-speech-recognition": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/@types/dom-speech-recognition/-/dom-speech-recognition-0.0.8.tgz",
"integrity": "sha512-JgpjlGQWGc+OjjTNfyJ8Ic2w2+NOdrmEpmdVAkg+sYblx8I5ZZTeA+cfxvgUMtXXT7/WzYYR2Rrp3ZDg+l/3vA==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/estree": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",

View File

@@ -17,6 +17,7 @@
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/dom-speech-recognition": "^0.0.8",
"@types/node": "^20.19.37",
"@types/react": "^19",
"@types/react-dom": "^19",

View File

@@ -1,7 +1,8 @@
import { NextRequest, NextResponse } from "next/server";
import { pipeline } from "@huggingface/transformers";
let transcriber: Awaited<ReturnType<typeof pipeline>> | null = null;
// Use a simple type instead of the complex inferred type
let transcriber: any | null = null;
async function getTranscriber() {
if (!transcriber) {
@@ -18,7 +19,7 @@ export async function POST(req: NextRequest) {
const { audio } = await req.json();
try {
const t = await getTranscriber();
const result = await (t as any)(Float32Array.from(audio), {
const result = await t(Float32Array.from(audio), {
chunk_length_s: 30,
});
return NextResponse.json({ text: result.text?.trim() ?? "" });

View File

@@ -6,6 +6,7 @@
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"types": ["dom-speech-recognition"],
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",