@yeaft/webchat-agent 0.0.114 → 0.0.116
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 -4
- package/package.json +1 -1
package/crew.js
CHANGED
|
@@ -1464,13 +1464,26 @@ export async function handleCrewHumanInput(msg) {
|
|
|
1464
1464
|
return;
|
|
1465
1465
|
}
|
|
1466
1466
|
|
|
1467
|
-
// 解析 @role
|
|
1468
|
-
const atMatch = content.match(/^@(\
|
|
1467
|
+
// 解析 @role 指令(支持 name 和 displayName)
|
|
1468
|
+
const atMatch = content.match(/^@(\S+)\s*([\s\S]*)/);
|
|
1469
1469
|
if (atMatch) {
|
|
1470
|
-
const
|
|
1470
|
+
const atTarget = atMatch[1];
|
|
1471
1471
|
const message = atMatch[2].trim() || content;
|
|
1472
1472
|
|
|
1473
|
-
|
|
1473
|
+
// 先精确匹配 role.name,再匹配 displayName
|
|
1474
|
+
let target = null;
|
|
1475
|
+
for (const [name, role] of session.roles) {
|
|
1476
|
+
if (name === atTarget.toLowerCase()) {
|
|
1477
|
+
target = name;
|
|
1478
|
+
break;
|
|
1479
|
+
}
|
|
1480
|
+
if (role.displayName === atTarget) {
|
|
1481
|
+
target = name;
|
|
1482
|
+
break;
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
if (target) {
|
|
1474
1487
|
// 检查目标角色是否正在忙
|
|
1475
1488
|
const targetState = session.roleStates.get(target);
|
|
1476
1489
|
if (targetState?.turnActive) {
|