@ququ-jiaxk/dsh-groupchat 0.1.11 → 0.1.12
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/index.js +11 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -382,6 +382,9 @@ function replyTargetOfRecentMember(state, group, message) {
|
|
|
382
382
|
function dispatch(state, group, message) {
|
|
383
383
|
const targets = new Set()
|
|
384
384
|
const sAgent = sagentOf(group)
|
|
385
|
+
// 只有附件、没有正文的消息也算「用户发言」,不能落进寒暄分支被静默丢弃
|
|
386
|
+
const hasAttachments = !!(message.attachments && message.attachments.length)
|
|
387
|
+
const attachmentLabel = hasAttachments ? '[附件] ' + message.attachments.map(a => a.name).join('、') : ''
|
|
385
388
|
// 解析 @ 目标(用户消息和 agent 消息都要用)
|
|
386
389
|
const addressed = resolveAddressedTo(group, message.addressedTo)
|
|
387
390
|
const addressedMembers = addressed.filter(t => memberSessionIds(group).has(t) && t !== sAgent)
|
|
@@ -396,12 +399,12 @@ function dispatch(state, group, message) {
|
|
|
396
399
|
if (addressedMembers.length > 0 && !userAddressedSagent) {
|
|
397
400
|
// 只 @ 了成员:只发给被点名的人
|
|
398
401
|
for (const t of addressedMembers) targets.add(t)
|
|
399
|
-
} else if (!userAddressedSagent && replyTargetOfRecentMember(state, group, message)) {
|
|
402
|
+
} else if (!userAddressedSagent && !hasAttachments && replyTargetOfRecentMember(state, group, message)) {
|
|
400
403
|
// 用户在对刚才那位成员说"谢谢/好的":交给**那位成员**回一句「不客气」。
|
|
401
404
|
// 既不是 PM 代答,也不是谁都不理。
|
|
402
405
|
const who = replyTargetOfRecentMember(state, group, message)
|
|
403
406
|
if (who && memberSessionIds(group).has(who)) targets.add(who)
|
|
404
|
-
} else if (!userAddressedSagent && isSmallTalkOnly(message.content)) {
|
|
407
|
+
} else if (!userAddressedSagent && !hasAttachments && isSmallTalkOnly(message.content)) {
|
|
405
408
|
// 没 @ 人、也没有明确对话对象的纯寒暄(如群里第一次说"你好")→ 不惊动任何人
|
|
406
409
|
} else {
|
|
407
410
|
targets.add(sAgent)
|
|
@@ -456,9 +459,12 @@ function dispatch(state, group, message) {
|
|
|
456
459
|
// summary 只是 inbox 预览,真正全文走 group_read_signal;但预览也不能砍半,
|
|
457
460
|
// 否则 agent 会用不完整的信息决策。仅对极端超长(>4000 字)做折叠,
|
|
458
461
|
// 并在折叠处明确标注剩余长度。
|
|
459
|
-
summary:
|
|
460
|
-
|
|
461
|
-
|
|
462
|
+
summary: (() => {
|
|
463
|
+
const base = String(message.content || '').trim() ? message.content : (attachmentLabel || '(空消息)')
|
|
464
|
+
return base.length > 4000
|
|
465
|
+
? base.slice(0, 4000) + `\n…(后续还有 ${base.length - 4000} 字,请用 group_read_signal 读全文后再执行)`
|
|
466
|
+
: base
|
|
467
|
+
})(),
|
|
462
468
|
messageId: message.id,
|
|
463
469
|
userMentioned,
|
|
464
470
|
})
|