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,44 @@
|
||||
const TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3ODIwNTI0MjksImlhdCI6MTc3OTQ2MDQyOSwidHlwZSI6ImFjY2VzcyIsInVzZXJfaWQiOiJhZG1pbiJ9.JK1dP61eqnHCxfkQrCYQf-mQKPLjDM0o3k2UHkcovZ0";
|
||||
const WS_URL = `ws://127.0.0.1:8080/ws/chat?token=${TOKEN}&session_id=test_iot_${Date.now()}`;
|
||||
|
||||
const ws = new WebSocket(WS_URL);
|
||||
let hasAction = false;
|
||||
|
||||
ws.onopen = () => {
|
||||
console.log('Connected');
|
||||
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);
|
||||
if (msg.type === 'response' && msg.msg_type === 'action') {
|
||||
console.log('✅ ACTION MESSAGE:', msg.content);
|
||||
hasAction = true;
|
||||
} else if (msg.type === 'response') {
|
||||
console.log('💬 CHAT MESSAGE:', msg.content, 'msg_type:', msg.msg_type);
|
||||
} else if (msg.type === 'stream_chunk') {
|
||||
process.stdout.write(msg.content || '');
|
||||
} else if (msg.type === 'stream_end') {
|
||||
console.log('\n--- stream_end ---');
|
||||
setTimeout(() => ws.close(), 500);
|
||||
} else if (msg.type === 'error') {
|
||||
console.log('Error:', msg.error);
|
||||
}
|
||||
} catch {}
|
||||
};
|
||||
|
||||
ws.onclose = () => {
|
||||
console.log('hasAction:', hasAction);
|
||||
process.exit(hasAction ? 0 : 0);
|
||||
};
|
||||
|
||||
ws.onerror = (err) => { console.error('WS error:', err.message); process.exit(1); };
|
||||
setTimeout(() => { console.log('Timeout'); ws.close(); process.exit(1); }, 35000);
|
||||
Reference in New Issue
Block a user