更新 package.json 和 pnpm-lock.yaml,修改版本号并添加依赖;重构 ASR 模块,优化音频处理逻辑,新增 AliyunAucChat 类及测试用例

This commit is contained in:
2025-12-22 01:49:48 +08:00
parent 00e91e8b28
commit 5db0418cb8
10 changed files with 219 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
const isBrowser = (typeof process === 'undefined') ||
(typeof window !== 'undefined' && typeof window.document !== 'undefined') ||
const isBrowser = (typeof process === 'undefined') ||
(typeof window !== 'undefined' && typeof window.document !== 'undefined') ||
(typeof process !== 'undefined' && process?.env?.BROWSER === 'true');
const chantHttpToWs = (url: string) => {
if (url.startsWith('http://')) {
@@ -24,7 +24,8 @@ export const initWs = async (url: string, options?: WebSocketOptions) => {
if (isBrowser) {
ws = new WebSocket(url);
} else {
const WebSocket = await import('ws').then((module) => module.default);
const wsPakcages = 'ws' // 避免vite 自动会默认的在浏览器引入ws然后报错
const WebSocket = await import(wsPakcages).then((module) => module.default);
const { rejectUnauthorized, headers, ...rest } = options || {};
ws = new WebSocket(url, {
rejectUnauthorized: rejectUnauthorized ?? true,