feat: 新增语音/图像识别能力(媒体会话、识别接口与路由)

识别只返回文本,不投递、不落库:语音支持 mp3/aac/wav/pcm,WebM 先按文件头识别再转 PCM;图片走 qwen-vl-ocr。新增 /health/ai/asr 与 /health/ai/ocr,登录后按用户限流 20 次/分钟,并对 /health/ai/ 前缀放宽请求体上限。
This commit is contained in:
lik
2026-10-31 17:02:42 +08:00
parent c4f6be6494
commit 8c6feaf42d
11 changed files with 2344 additions and 1 deletions
+206
View File
@@ -8,6 +8,7 @@
"name": "attendant-api",
"version": "1.0.0",
"dependencies": {
"@audio/decode-webm": "^1.6.1",
"@langchain/anthropic": "^1.5.9",
"@langchain/core": "^1.2.9",
"@langchain/deepseek": "^1.1.11",
@@ -61,6 +62,138 @@
}
}
},
"node_modules/@audio/decode-aac": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@audio/decode-aac/-/decode-aac-1.6.0.tgz",
"integrity": "sha512-4EdPNlHkFstqlfZhMC1pER+SKKldh1ZubD2VaxLAxSPH8fLA6upwVCVyMnqZ41PD6XTBrvf87aRZ0aPQTb4eiw==",
"license": "GPL-2.0",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/audiojs"
}
},
"node_modules/@audio/decode-ac3": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@audio/decode-ac3/-/decode-ac3-1.0.0.tgz",
"integrity": "sha512-GR2PLqxxrybNRwdA3/ZazB4ZWz7yQNihYtjuigGfEpSqKt95FnUgjIVfE7aJmznvxa6voq8Mou6NvSoTqH104g==",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/audiojs"
}
},
"node_modules/@audio/decode-dts": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@audio/decode-dts/-/decode-dts-1.0.0.tgz",
"integrity": "sha512-WApeOndo8C+3IzncPFg7vwRm9/ZbWjCzB93mx86en/+4/IWpUVz0W/wRINzg5gKGQa23xz5ZwGMGNC0X7i8nJw==",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/audiojs"
}
},
"node_modules/@audio/decode-eac3": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@audio/decode-eac3/-/decode-eac3-1.0.0.tgz",
"integrity": "sha512-2UFpJUhI6MBouhP7Dztby5xfTem38Ql1QYxDnqqJAINI65O6xjqGqlxQgpWIwH/oZ2imaRislsTu0X0IrPe3+A==",
"license": "LGPL-2.1-or-later",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/audiojs"
}
},
"node_modules/@audio/decode-flac": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/@audio/decode-flac/-/decode-flac-1.3.5.tgz",
"integrity": "sha512-ZaPeaprVjBpFfTFRjrfzWpxj5MBVJZR0j90g7aCfDTb82KFEdsVaf5cMrrVCKKrnSu0b2VBqXnEm6JZY1poTpA==",
"license": "MIT",
"dependencies": {
"@wasm-audio-decoders/flac": "~0.2.10",
"codec-parser": "~2.5.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/audiojs"
}
},
"node_modules/@audio/decode-mp3": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/@audio/decode-mp3/-/decode-mp3-1.3.1.tgz",
"integrity": "sha512-GhGm6C2hwngU+t5uEpUc94jZGCrCIXrgfneDURfK9/2tgFAWHVeckFNsSRmL4+Vd7u32uv8wQamjTnBSlrkVGA==",
"license": "MIT",
"dependencies": {
"mpg123-decoder": "^1.0.3"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/audiojs"
}
},
"node_modules/@audio/decode-opus": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/@audio/decode-opus/-/decode-opus-1.3.3.tgz",
"integrity": "sha512-/iykUcA9cgdqqj9pLwPjBkJ4z+WlpLIyWA4xGzvTBkHb1uWpMxYX5yoG+slw8HhmBmrBP2LxKqw6i779g4acVA==",
"license": "MIT",
"dependencies": {
"codec-parser": "~2.5.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/audiojs"
}
},
"node_modules/@audio/decode-vorbis": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/@audio/decode-vorbis/-/decode-vorbis-1.3.4.tgz",
"integrity": "sha512-0bgH1zgLlpgjdHj9NWdiYkMeLyCz5w1UEuvg2qiwJFXbwYSvRhOcmeT82CQUlb8RZSblS3AWpDJzLnAmQJ2cgg==",
"license": "MIT",
"dependencies": {
"@wasm-audio-decoders/ogg-vorbis": "~0.1.20",
"codec-parser": "~2.5.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/audiojs"
}
},
"node_modules/@audio/decode-webm": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/@audio/decode-webm/-/decode-webm-1.6.1.tgz",
"integrity": "sha512-Te5A7MOUKV2Eb0y3iIFQMhg0dT8IC2I/8Hwc8BZlsHjU9Ka1qoH+LpWiFPrImOCvRcMDr6hd3qilkvBy3PJRDw==",
"license": "MIT",
"dependencies": {
"@audio/decode-aac": "^1.5.0",
"@audio/decode-ac3": "^1.0.0",
"@audio/decode-dts": "^1.0.0",
"@audio/decode-eac3": "^1.0.0",
"@audio/decode-flac": "^1.3.0",
"@audio/decode-mp3": "^1.3.0",
"@audio/decode-opus": "^1.3.0",
"@audio/decode-vorbis": "^1.3.0"
},
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/audiojs"
}
},
"node_modules/@babel/runtime": {
"version": "7.29.7",
"resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.29.7.tgz",
@@ -96,6 +229,12 @@
"kuler": "^2.0.0"
}
},
"node_modules/@eshaz/web-worker": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@eshaz/web-worker/-/web-worker-1.2.2.tgz",
"integrity": "sha512-WxXiHFmD9u/owrzempiDlBB1ZYqiLnm9s6aPc8AlFQalq2tKmqdmMr9GXOupDgzXtqnBipj8Un0gkIm7Sjf8mw==",
"license": "Apache-2.0"
},
"node_modules/@hapi/bourne": {
"version": "3.0.0",
"resolved": "https://registry.npmmirror.com/@hapi/bourne/-/bourne-3.0.0.tgz",
@@ -477,6 +616,44 @@
"@types/webidl-conversions": "*"
}
},
"node_modules/@wasm-audio-decoders/common": {
"version": "9.0.7",
"resolved": "https://registry.npmjs.org/@wasm-audio-decoders/common/-/common-9.0.7.tgz",
"integrity": "sha512-WRaUuWSKV7pkttBygml/a6dIEpatq2nnZGFIoPTc5yPLkxL6Wk4YaslPM98OPQvWacvNZ+Py9xROGDtrFBDzag==",
"license": "MIT",
"dependencies": {
"@eshaz/web-worker": "1.2.2",
"simple-yenc": "^1.0.4"
}
},
"node_modules/@wasm-audio-decoders/flac": {
"version": "0.2.11",
"resolved": "https://registry.npmjs.org/@wasm-audio-decoders/flac/-/flac-0.2.11.tgz",
"integrity": "sha512-bbSGuDDxY89CrS7FYc2cBBfvtgk3EY9As8dVe8PFIgX7ECd/wefdi8UbGlvcdQZczRwE500KBt4cqf/+mMVsfw==",
"license": "MIT",
"dependencies": {
"@wasm-audio-decoders/common": "9.0.7",
"codec-parser": "2.5.0"
},
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/eshaz"
}
},
"node_modules/@wasm-audio-decoders/ogg-vorbis": {
"version": "0.1.20",
"resolved": "https://registry.npmjs.org/@wasm-audio-decoders/ogg-vorbis/-/ogg-vorbis-0.1.20.tgz",
"integrity": "sha512-zaQPasU5usRjUDXtXOHYED5tfkR4QMXd+EH3Nrz1+4+M5pCsdD+s9YxJqb0oqnTyRu/KUujOmu5Z/m/NT47vwg==",
"license": "MIT",
"dependencies": {
"@wasm-audio-decoders/common": "9.0.7",
"codec-parser": "2.5.0"
},
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/eshaz"
}
},
"node_modules/abbrev": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/abbrev/-/abbrev-1.1.1.tgz",
@@ -773,6 +950,12 @@
"node": ">=8.0.0"
}
},
"node_modules/codec-parser": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/codec-parser/-/codec-parser-2.5.0.tgz",
"integrity": "sha512-Ru9t80fV8B0ZiixQl8xhMTLru+dzuis/KQld32/x5T/+3LwZb0/YvQdSKytX9JqCnRdiupvAvyYJINKrXieziQ==",
"license": "LGPL-3.0-or-later"
},
"node_modules/color": {
"version": "5.0.3",
"resolved": "https://registry.npmmirror.com/color/-/color-5.0.3.tgz",
@@ -2124,6 +2307,19 @@
"node": ">=4.0.0"
}
},
"node_modules/mpg123-decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/mpg123-decoder/-/mpg123-decoder-1.0.3.tgz",
"integrity": "sha512-+fjxnWigodWJm3+4pndi+KUg9TBojgn31DPk85zEsim7C6s0X5Ztc/hQYdytXkwuGXH+aB0/aEkG40Emukv6oQ==",
"license": "MIT",
"dependencies": {
"@wasm-audio-decoders/common": "9.0.7"
},
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/eshaz"
}
},
"node_modules/mquery": {
"version": "5.0.0",
"resolved": "https://registry.npmmirror.com/mquery/-/mquery-5.0.0.tgz",
@@ -2777,6 +2973,16 @@
"node": ">=10"
}
},
"node_modules/simple-yenc": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/simple-yenc/-/simple-yenc-1.0.4.tgz",
"integrity": "sha512-5gvxpSd79e9a3V4QDYUqnqxeD4HGlhCakVpb6gMnDD7lexJggSBJRBO5h52y/iJrdXRilX9UCuDaIJhSWm5OWw==",
"license": "MIT",
"funding": {
"type": "individual",
"url": "https://github.com/sponsors/eshaz"
}
},
"node_modules/sparse-bitfield": {
"version": "3.0.3",
"resolved": "https://registry.npmmirror.com/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",