@finogeeks2026/chatkit-web 0.0.12 → 0.0.13

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -680,11 +680,14 @@ const Ui = (e) => {
680
680
  currentSessionId: null,
681
681
  isLoading: !1,
682
682
  createSession: (n = "新对话") => {
683
- const r = dn();
684
- return r.title = n, e((i) => ({
685
- sessions: [r, ...i.sessions],
686
- currentSessionId: r.id
687
- })), r.id;
683
+ const r = t(), i = r.currentSessionId ? r.sessions.find((o) => o.id === r.currentSessionId) : null;
684
+ if (i && i.messages.length === 0)
685
+ return i.id;
686
+ const a = dn();
687
+ return a.title = n, e((o) => ({
688
+ sessions: [a, ...o.sessions],
689
+ currentSessionId: a.id
690
+ })), a.id;
688
691
  },
689
692
  switchSession: (n) => {
690
693
  t().sessions.some((r) => r.id === n) && e({ currentSessionId: n });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finogeeks2026/chatkit-web",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "面向 Web / H5 的 AI 对话 UI SDK,支持流式对话、多会话管理、主题定制",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",