"feat: 更新ASR服务连接配置,优化录音流处理及模型路径"

This commit is contained in:
2025-06-02 12:38:53 +08:00
parent e638d7907a
commit 232d799575
8 changed files with 242 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
const isBrowser = process?.env?.BROWSER === 'true';
const isBrowser = process?.env?.BROWSER === 'true' || typeof window !== 'undefined' && typeof window.document !== 'undefined';
import { EventEmitter } from 'events';
type WebSocketOptions = {
@@ -17,7 +17,7 @@ export const initWs = async (url: string, options?: WebSocketOptions) => {
const WebSocket = await import('ws').then((module) => module.default);
const { rejectUnauthorized, headers, ...rest } = options || {};
ws = new WebSocket(url, {
rejectUnauthorized: rejectUnauthorized || true,
rejectUnauthorized: rejectUnauthorized ?? true,
headers: headers,
...rest,
}) as any;