@blueking/chat-helper 0.0.11 → 0.0.12-beta.1

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.
@@ -126,10 +126,17 @@ import { ref } from 'vue';
126
126
  var // 中止当前聊天
127
127
  _mediator_agent;
128
128
  (_mediator_agent = mediator.agent) === null || _mediator_agent === void 0 ? void 0 : _mediator_agent.abortChat();
129
- // 从接口更新当前会话信息
130
- yield getSession(sessionCode);
129
+ const shouldLoadMessages = (options === null || options === void 0 ? void 0 : options.loadMessages) !== false;
130
+ const localSession = list.value.find((item)=>item.sessionCode === sessionCode);
131
+ // 新会话或明确空会话已在本地列表中,无需额外 GET 会话详情。
132
+ if (!shouldLoadMessages && localSession) {
133
+ current.value = localSession;
134
+ } else {
135
+ // 从接口更新当前会话信息
136
+ yield getSession(sessionCode);
137
+ }
131
138
  // 默认加载消息,但允许跳过(新会话消息必定为空,无需加载)
132
- if ((options === null || options === void 0 ? void 0 : options.loadMessages) !== false) {
139
+ if (shouldLoadMessages) {
133
140
  var _mediator_message, // 继续聊天
134
141
  _mediator_agent1;
135
142
  // 获取会话内容
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueking/chat-helper",
3
- "version": "0.0.11",
3
+ "version": "0.0.12-beta.1",
4
4
  "description": "",
5
5
  "main": "./dist/index.ts.js",
6
6
  "types": "./dist/index.d.ts",