shouldReuseImConversationOnCreate
发起会话时是否按精确成员集合复用已有行。由前端决定后传给 POST /im/conversation 的 reuse。
函数签名
typescript
function shouldReuseImConversationOnCreate(options: {
memberIds: readonly string[]
agentUserIds: ReadonlySet<string> | Iterable<string>
}): boolean工作原理
- 对
memberIds去重、去空。 - 若为空,返回
true(默认复用)。 - 若每个所选对方都在
agentUserIds中,返回false(新开一条)。 - 否则返回
true。
使用场景
- 选单个用户 / 联系人发消息:
reuse: true - 选单个 Agent、或多人里全是 Agent:
reuse: false - 多人里至少有一个非 Agent:
reuse: true