@yeaft/webchat-agent 0.0.119 → 0.0.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/crew.js +17 -3
- package/package.json +1 -1
package/crew.js
CHANGED
|
@@ -1525,9 +1525,23 @@ async function processHumanQueue(session) {
|
|
|
1525
1525
|
if (session._processingHumanQueue) return;
|
|
1526
1526
|
session._processingHumanQueue = true;
|
|
1527
1527
|
try {
|
|
1528
|
-
const
|
|
1529
|
-
|
|
1530
|
-
|
|
1528
|
+
const msgs = session.humanMessageQueue.splice(0);
|
|
1529
|
+
if (msgs.length === 1) {
|
|
1530
|
+
const humanPrompt = `人工消息:\n${msgs[0].content}`;
|
|
1531
|
+
await dispatchToRole(session, msgs[0].target, humanPrompt, 'human');
|
|
1532
|
+
} else {
|
|
1533
|
+
// 按 target 分组,合并发送
|
|
1534
|
+
const byTarget = new Map();
|
|
1535
|
+
for (const m of msgs) {
|
|
1536
|
+
if (!byTarget.has(m.target)) byTarget.set(m.target, []);
|
|
1537
|
+
byTarget.get(m.target).push(m.content);
|
|
1538
|
+
}
|
|
1539
|
+
for (const [target, contents] of byTarget) {
|
|
1540
|
+
const combined = contents.join('\n\n---\n\n');
|
|
1541
|
+
const humanPrompt = `人工消息:\n你有 ${contents.length} 条待处理消息,请一并分析并用多个 ROUTE 块并行分配:\n\n${combined}`;
|
|
1542
|
+
await dispatchToRole(session, target, humanPrompt, 'human');
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1531
1545
|
} finally {
|
|
1532
1546
|
session._processingHumanQueue = false;
|
|
1533
1547
|
}
|