a67b95cbc4
- IoT Provider: 重写Execute()支持多设备命令批量执行,修复persona路径 - Intent Analyzer: 新增isStrongIoTCommand快速通道,跳过LLM分析节省2-3s - Orchestrator: parseReviewMessages()内联审查 + 快速通道扩展(chat/greeting跳过子会话) - Gateway: SSE review_messages解析→WebSocket结构化消息转发(action/chat) - Persona: 对话风格注入action格式指令(括号包裹动作描述) - Frontend: sessionStore历史消息msgType映射 - 新增E2E测试脚本 + 调试标准文档 + 第4轮修复报告 E2E验证: IoT设备操控✅ Review消息拆分✅ 快速通道✅ 响应时间~3.4s Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
// Quick WebSocket test for review pipeline
|
|
const WebSocket = require('ws');
|
|
|
|
const TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3ODIwNTIwNDYsImlhdCI6MTc3OTQ2MDA0NiwidHlwZSI6ImFjY2VzcyIsInVzZXJfaWQiOiJhZG1pbiJ9.dmNrCJsz576eEvNWlXVNP7BdZDEpijJ73pSrcqmTJdE';
|
|
const WS_URL = `ws://127.0.0.1:8080/ws/chat?token=${TOKEN}&session_id=test_review_${Date.now()}`;
|
|
|
|
const ws = new WebSocket(WS_URL);
|
|
|
|
ws.on('open', () => {
|
|
console.log('Connected to WebSocket');
|
|
|
|
// Send a message that should trigger IoT action response with parenthetical format
|
|
ws.send(JSON.stringify({
|
|
type: 'message',
|
|
content: '帮我把客厅灯打开',
|
|
session_id: null,
|
|
mode: 'text',
|
|
timestamp: Date.now()
|
|
}));
|
|
console.log('Sent: 帮我把客厅灯打开');
|
|
});
|
|
|
|
ws.on('message', (data) => {
|
|
try {
|
|
const msg = JSON.parse(data.toString());
|
|
console.log(`\n[${msg.type}]`, JSON.stringify(msg, null, 2).substring(0, 500));
|
|
|
|
if (msg.type === 'response' || msg.type === 'review') {
|
|
console.log('✅ Got response/review message!');
|
|
}
|
|
if (msg.type === 'stream_end') {
|
|
console.log('Stream ended, closing...');
|
|
setTimeout(() => ws.close(), 1000);
|
|
}
|
|
if (msg.type === 'error') {
|
|
console.log('❌ Error:', msg.error);
|
|
ws.close();
|
|
}
|
|
} catch (e) {
|
|
console.log('Raw:', data.toString().substring(0, 200));
|
|
}
|
|
});
|
|
|
|
ws.on('close', () => {
|
|
console.log('Connection closed');
|
|
process.exit(0);
|
|
});
|
|
|
|
ws.on('error', (err) => {
|
|
console.error('WebSocket error:', err.message);
|
|
process.exit(1);
|
|
});
|
|
|
|
setTimeout(() => {
|
|
console.log('Timeout - closing');
|
|
ws.close();
|
|
process.exit(1);
|
|
}, 30000);
|