This commit is contained in:
2025-12-29 01:34:19 +08:00
parent 91409861b9
commit 9f580a7709
4 changed files with 9 additions and 11 deletions

View File

@@ -47,7 +47,7 @@ app
} }
}) })
.define(async (ctx) => { .define(async (ctx) => {
// https://localhost:51015/client/router?path=shop&key=install // https://localhost:51515/client/router?path=shop&key=install
const options = ctx.query?.data || {}; const options = ctx.query?.data || {};
const { id, type, force, yes } = options; const { id, type, force, yes } = options;
assistantConfig.checkMounted(); assistantConfig.checkMounted();
@@ -74,7 +74,7 @@ app
} }
}) })
.define(async (ctx) => { .define(async (ctx) => {
// https://localhost:51015/client/router?path=shop&key=uninstall // https://localhost:51515/client/router?path=shop&key=uninstall
const options = ctx.query?.data || {}; const options = ctx.query?.data || {};
const { id, type, yes } = options; const { id, type, yes } = options;
const app = new AppDownload(assistantConfig); const app = new AppDownload(assistantConfig);

View File

@@ -93,20 +93,18 @@ const func: WebSocketListenerFun = async (req: WebSocketReq<{ asr: QwenAsrRelati
console.log('ASR receive data', 'blank voice'); console.log('ASR receive data', 'blank voice');
} else if (data?.voice) { } else if (data?.voice) {
if (!data?.isRelatime) { if (!data?.isRelatime) {
console.log('ASR receive data', 'has voice', !!data?.voice); console.log('ASR receive data', 'has voice', !!data?.voice, data?.isRelatime);
}
const isBrowserFormat = data.format === 'float32';
const time = data?.time || 0; const time = data?.time || 0;
if (time) {
console.log('receiveDelay', Date.now() - time); console.log('receiveDelay', Date.now() - time);
} }
const isBrowserFormat = data.format === 'float32';
let voice: Buffer; let voice: Buffer;
if (isBrowserFormat) { if (isBrowserFormat) {
voice = await asr.fixBrowerBuffer(data.voice); voice = await asr.fixBrowerBuffer(data.voice);
} else { } else {
voice = Buffer.from(data.voice, 'base64'); voice = Buffer.from(data.voice, 'base64');
} }
console.log('sendTime', Date.now());
ws.data.startTime = Date.now(); ws.data.startTime = Date.now();
asr.sendBuffer(voice); asr.sendBuffer(voice);
} }

View File

@@ -8,8 +8,8 @@ const testRouter = () => {
// const ws = new WebSocket('ws://118.196.32.29:3005/api/router'); // const ws = new WebSocket('ws://118.196.32.29:3005/api/router');
// const ws = new WebSocket('wss://kevisual.cn/api/router'); // const ws = new WebSocket('wss://kevisual.cn/api/router');
// const ws = new WebSocket('ws://localhost:51015/api/ws/demo?id=12345'); // const ws = new WebSocket('ws://localhost:51515/api/ws/demo?id=12345');
const ws = new WebSocket('ws://localhost:51015/api/router?id=12345'); const ws = new WebSocket('ws://localhost:51515/api/router?id=12345');
console.log('Connecting to WebSocket server...'); console.log('Connecting to WebSocket server...');
ws.on('open', () => { ws.on('open', () => {
console.log('WebSocket connection opened'); console.log('WebSocket connection opened');

View File

@@ -10,7 +10,7 @@ import dotenv from 'dotenv';
dotenv.config(); dotenv.config();
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
let target = process.env.VITE_API_URL || 'http://localhost:51015'; let target = process.env.VITE_API_URL || 'http://localhost:51515';
const apiProxy = { target: target, changeOrigin: true, ws: true, rewriteWsOrigin: true, secure: false, cookieDomainRewrite: 'localhost' }; const apiProxy = { target: target, changeOrigin: true, ws: true, rewriteWsOrigin: true, secure: false, cookieDomainRewrite: 'localhost' };
let proxy = { let proxy = {
'/root/': apiProxy, '/root/': apiProxy,