@blueking/ai-blueking 2.1.4-beta.20 → 2.1.4-beta.21

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.
@@ -1516,8 +1516,10 @@ var Ue = (e) => {
1516
1516
  t.value = e;
1517
1517
  }).finally(() => {
1518
1518
  i.value = !1;
1519
- })), f = async (t, n) => {
1520
- e.agent?.abortChat(), await p(t), n?.loadMessages === !1 ? e.message && (e.message.list.value = []) : (await e.message?.getMessages(t), e.agent?.resumeStreamingChat(t));
1519
+ })), f = async (r, i) => {
1520
+ e.agent?.abortChat();
1521
+ let a = i?.loadMessages !== !1, o = t.value.find((e) => e.sessionCode === r);
1522
+ !a && o ? n.value = o : await p(r), a ? (await e.message?.getMessages(r), e.agent?.resumeStreamingChat(r)) : e.message && (e.message.list.value = []);
1521
1523
  }, p = (t) => (r.value = !0, e.http?.session.getSession(t).then((e) => {
1522
1524
  n.value = e;
1523
1525
  }).finally(() => {
@@ -2648,12 +2650,20 @@ var Pt = { class: "left-section" }, Ft = { class: "logo" }, It = ["src"], Lt = {
2648
2650
  }), e;
2649
2651
  }
2650
2652
  }
2653
+ isSessionEmpty(e) {
2654
+ return e.sessionContentCount === 0;
2655
+ }
2656
+ findSession(e) {
2657
+ return this.sessionList.value.find((t) => t.sessionCode === e);
2658
+ }
2651
2659
  async loadRecentSession(e) {
2652
2660
  try {
2661
+ if (this.currentSession.value?.sessionCode) return;
2653
2662
  e?.skipLoadSessions || await this.loadSessions();
2654
2663
  let t = this.sessionList.value;
2655
2664
  if (this.config.initialSessionCode) {
2656
- await this.switchSession(this.config.initialSessionCode);
2665
+ let e = this.findSession(this.config.initialSessionCode);
2666
+ await this.switchSession(this.config.initialSessionCode, { loadMessages: e ? !this.isSessionEmpty(e) : !0 });
2657
2667
  return;
2658
2668
  }
2659
2669
  if (t.length > 0) {