@zero-library/chat-copilot 3.1.21 → 3.1.22

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.
package/dist/index.cjs.js CHANGED
@@ -1373,7 +1373,17 @@ function createChatStore() {
1373
1373
  isFavorite: true
1374
1374
  }
1375
1375
  });
1376
- favorite.list.items = data || [];
1376
+ const resultItems = common.transforms(data || [], {
1377
+ key: "id",
1378
+ id: "id",
1379
+ label: "title",
1380
+ spec: "spec",
1381
+ isFavorite: "isFavorite",
1382
+ group: (c) => {
1383
+ return classifyTime(c.updatedAt);
1384
+ }
1385
+ });
1386
+ favorite.list.items = resultItems;
1377
1387
  } finally {
1378
1388
  favorite.loading = false;
1379
1389
  }
@@ -2324,12 +2334,8 @@ var styles_module_default2 = {
2324
2334
  chatHeaderBtnGroup: "styles_module_chatHeaderBtnGroup",
2325
2335
  conversationListPanel: "styles_module_conversationListPanel",
2326
2336
  createConversationButton: "styles_module_createConversationButton",
2327
- conversationListContent: "styles_module_conversationListContent",
2328
2337
  conversations: "styles_module_conversations",
2329
- conversationTabs: "styles_module_conversationTabs",
2330
- conversationTabPane: "styles_module_conversationTabPane",
2331
2338
  conversationEmpty: "styles_module_conversationEmpty",
2332
- conversationScrollArea: "styles_module_conversationScrollArea",
2333
2339
  chatWelcomeWrap: "styles_module_chatWelcomeWrap",
2334
2340
  chatWelcome: "styles_module_chatWelcome",
2335
2341
  promptItem: "styles_module_promptItem",
@@ -2346,6 +2352,32 @@ var styles_module_default2 = {
2346
2352
  senderReferenceHeaderTitle: "styles_module_senderReferenceHeaderTitle",
2347
2353
  senderReferenceHeaderContent: "styles_module_senderReferenceHeaderContent"
2348
2354
  };
2355
+ var ConversationTabPane = ({ items, activeKey, emptyDescription, scrollableTarget, menu, onActiveChange }) => {
2356
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "height-full", children: items.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "height-full scroll-fade-in", id: scrollableTarget, children: /* @__PURE__ */ jsxRuntime.jsx(
2357
+ InfiniteScroll__default.default,
2358
+ {
2359
+ dataLength: items.length,
2360
+ hasMore: false,
2361
+ next: () => {
2362
+ console2__default.default.log("next");
2363
+ },
2364
+ loader: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { indicator: /* @__PURE__ */ jsxRuntime.jsx(icons.RedoOutlined, { spin: true }), size: "small" }) }),
2365
+ style: { overflow: "hidden" },
2366
+ scrollableTarget,
2367
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2368
+ xV2.Conversations,
2369
+ {
2370
+ className: styles_module_default2.conversations,
2371
+ items,
2372
+ activeKey,
2373
+ onActiveChange: async (id) => onActiveChange(id),
2374
+ groupable: true,
2375
+ menu
2376
+ }
2377
+ )
2378
+ }
2379
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationEmpty, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: emptyDescription, image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) });
2380
+ };
2349
2381
  var ConversationList_default = () => {
2350
2382
  const chatStore = useChatStore();
2351
2383
  const agentState = valtio.useSnapshot(chatStore.agent);
@@ -2361,15 +2393,7 @@ var ConversationList_default = () => {
2361
2393
  return conversationsState.list.items.filter((item) => item.label);
2362
2394
  }, [conversationsState.list.items]);
2363
2395
  const favoriteConversationList = React10.useMemo(() => {
2364
- return favoriteState.list.items.filter((item) => item.title).map((item) => ({
2365
- ...item,
2366
- key: item.id,
2367
- id: item.id,
2368
- label: item.title,
2369
- spec: item.spec,
2370
- isFavorite: true,
2371
- group: classifyTime(item.updatedAt)
2372
- }));
2396
+ return favoriteState.list.items.filter((item) => item.label);
2373
2397
  }, [favoriteState.list.items]);
2374
2398
  const historyMenuConfig = (conversation) => ({
2375
2399
  items: [
@@ -2422,72 +2446,48 @@ var ConversationList_default = () => {
2422
2446
  ),
2423
2447
  items: []
2424
2448
  });
2425
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationTabs, children: /* @__PURE__ */ jsxRuntime.jsx(
2449
+ const handleConversationChange = async (id) => chatStore.switchConversation(id);
2450
+ return /* @__PURE__ */ jsxRuntime.jsx(
2426
2451
  antd.Tabs,
2427
2452
  {
2428
2453
  activeKey: activeTabKey,
2429
2454
  centered: true,
2455
+ className: "full-tabs",
2430
2456
  onChange: setActiveTabKey,
2431
2457
  items: [
2432
2458
  {
2433
2459
  key: "history",
2434
2460
  label: "\u5386\u53F2\u4F1A\u8BDD",
2435
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationTabPane, children: conversationList.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationScrollArea, id: "historyConversationScrollableDiv", children: /* @__PURE__ */ jsxRuntime.jsx(
2436
- InfiniteScroll__default.default,
2461
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2462
+ ConversationTabPane,
2437
2463
  {
2438
- dataLength: conversationList.length,
2439
- hasMore: false,
2440
- next: () => {
2441
- console2__default.default.log("next");
2442
- },
2443
- loader: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { indicator: /* @__PURE__ */ jsxRuntime.jsx(icons.RedoOutlined, { spin: true }), size: "small" }) }),
2444
- style: { overflow: "hidden" },
2464
+ items: conversationList,
2465
+ activeKey: conversationState.active.id,
2466
+ emptyDescription: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55",
2445
2467
  scrollableTarget: "historyConversationScrollableDiv",
2446
- children: /* @__PURE__ */ jsxRuntime.jsx(
2447
- xV2.Conversations,
2448
- {
2449
- className: styles_module_default2.conversations,
2450
- items: conversationList,
2451
- activeKey: conversationState.active.id,
2452
- onActiveChange: async (id) => chatStore.switchConversation(id),
2453
- groupable: true,
2454
- menu: historyMenuConfig
2455
- }
2456
- )
2468
+ menu: historyMenuConfig,
2469
+ onActiveChange: handleConversationChange
2457
2470
  }
2458
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationEmpty, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) })
2471
+ )
2459
2472
  },
2460
2473
  {
2461
2474
  key: "favorite",
2462
2475
  label: "\u6536\u85CF\u4F1A\u8BDD",
2463
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationTabPane, children: favoriteConversationList.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationScrollArea, id: "favoriteConversationScrollableDiv", children: /* @__PURE__ */ jsxRuntime.jsx(
2464
- InfiniteScroll__default.default,
2476
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2477
+ ConversationTabPane,
2465
2478
  {
2466
- dataLength: favoriteConversationList.length,
2467
- hasMore: false,
2468
- next: () => {
2469
- console2__default.default.log("next");
2470
- },
2471
- loader: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { indicator: /* @__PURE__ */ jsxRuntime.jsx(icons.RedoOutlined, { spin: true }), size: "small" }) }),
2472
- style: { overflow: "hidden" },
2479
+ items: favoriteConversationList,
2480
+ activeKey: conversationState.active.id,
2481
+ emptyDescription: "\u6682\u65E0\u6536\u85CF\u4F1A\u8BDD",
2473
2482
  scrollableTarget: "favoriteConversationScrollableDiv",
2474
- children: /* @__PURE__ */ jsxRuntime.jsx(
2475
- xV2.Conversations,
2476
- {
2477
- className: styles_module_default2.conversations,
2478
- items: favoriteConversationList,
2479
- activeKey: conversationState.active.id,
2480
- onActiveChange: async (id) => chatStore.switchConversation(id),
2481
- groupable: true,
2482
- menu: favoriteMenuConfig
2483
- }
2484
- )
2483
+ menu: favoriteMenuConfig,
2484
+ onActiveChange: handleConversationChange
2485
2485
  }
2486
- ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationEmpty, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u6536\u85CF\u4F1A\u8BDD", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) })
2486
+ )
2487
2487
  }
2488
2488
  ]
2489
2489
  }
2490
- ) });
2490
+ );
2491
2491
  };
2492
2492
 
2493
2493
  // src/ui/common/FeatureComponents/style.module.less
@@ -2621,9 +2621,9 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
2621
2621
  ] });
2622
2622
  };
2623
2623
  var ConversationListPanel = ({ header }) => {
2624
- return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
2624
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("height-full", "zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
2625
2625
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
2626
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationListContent, children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
2626
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
2627
2627
  ] });
2628
2628
  };
2629
2629
  var ConversationListPanel_default = ConversationListPanel;