fix: IoT多设备支持 + Review Pipeline审查消息 + 意图分析快速通道优化
- 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>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
// Quick WebSocket test for review pipeline
|
||||
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.onopen = () => {
|
||||
console.log('Connected to WebSocket');
|
||||
|
||||
ws.send(JSON.stringify({
|
||||
type: 'message',
|
||||
content: '帮我把客厅灯打开',
|
||||
session_id: null,
|
||||
mode: 'text',
|
||||
timestamp: Date.now()
|
||||
}));
|
||||
console.log('Sent: 帮我把客厅灯打开');
|
||||
};
|
||||
|
||||
ws.onmessage = (event) => {
|
||||
try {
|
||||
const msg = JSON.parse(event.data);
|
||||
const short = JSON.stringify(msg).substring(0, 400);
|
||||
console.log(`[${msg.type}]`, short);
|
||||
|
||||
if (msg.type === 'response' && msg.msg_type === 'action') {
|
||||
console.log('✅ Got ACTION message!');
|
||||
}
|
||||
if (msg.type === 'response' && msg.msg_type === 'chat') {
|
||||
console.log('✅ Got CHAT message!');
|
||||
}
|
||||
if (msg.type === 'stream_end') {
|
||||
console.log('Stream ended, closing...');
|
||||
setTimeout(() => ws.close(), 500);
|
||||
}
|
||||
if (msg.type === 'error') {
|
||||
console.log('Error:', msg.error);
|
||||
ws.close();
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Raw:', event.data.substring(0, 300));
|
||||
}
|
||||
};
|
||||
|
||||
ws.onclose = () => {
|
||||
console.log('Connection closed');
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
ws.onerror = (err) => {
|
||||
console.error('WebSocket error:', err.message);
|
||||
process.exit(1);
|
||||
};
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('Timeout (30s) - closing');
|
||||
ws.close();
|
||||
process.exit(1);
|
||||
}, 30000);
|
||||
Reference in New Issue
Block a user