Skip to content

shouldReuseImConversationOnCreate

发起会话时是否按精确成员集合复用已有行。由前端决定后传给 POST /im/conversationreuse

函数签名

typescript
function shouldReuseImConversationOnCreate(options: {
  memberIds: readonly string[]
  agentUserIds: ReadonlySet<string> | Iterable<string>
}): boolean

工作原理

  1. memberIds 去重、去空。
  2. 若为空,返回 true(默认复用)。
  3. 若每个所选对方都在 agentUserIds 中,返回 false(新开一条)。
  4. 否则返回 true

使用场景

  • 选单个用户 / 联系人发消息:reuse: true
  • 选单个 Agent、或多人里全是 Agent:reuse: false
  • 多人里至少有一个非 Agent:reuse: true