@zero-library/chat-copilot 3.1.21 → 3.1.23

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
@@ -1198,9 +1198,10 @@ function createChatStore() {
1198
1198
  /** 智能体加载状态 */
1199
1199
  loading: false
1200
1200
  });
1201
- const setAgentModel = (model) => {
1202
- agent.model = { ...agent.model, ...model };
1203
- config.hooks?.onAfterSwitchModel?.(model);
1201
+ const setAgentModel = (updater) => {
1202
+ const nextPatch = typeof updater === "function" ? updater(agent.model) : updater;
1203
+ agent.model = { ...agent.model, ...nextPatch };
1204
+ config.hooks?.onAfterSwitchModel?.(agent.model);
1204
1205
  };
1205
1206
  const getUserInput = async (agentId) => {
1206
1207
  agent.loading = true;
@@ -1297,6 +1298,7 @@ function createChatStore() {
1297
1298
  };
1298
1299
  const initConversation = async (config2) => {
1299
1300
  await getConversations(config2.agent.id);
1301
+ await getConversationFavorite();
1300
1302
  if (config2?.conversationId) {
1301
1303
  switchConversation(config2.conversationId);
1302
1304
  } else {
@@ -1373,7 +1375,17 @@ function createChatStore() {
1373
1375
  isFavorite: true
1374
1376
  }
1375
1377
  });
1376
- favorite.list.items = data || [];
1378
+ const resultItems = common.transforms(data || [], {
1379
+ key: "id",
1380
+ id: "id",
1381
+ label: "title",
1382
+ spec: "spec",
1383
+ isFavorite: "isFavorite",
1384
+ group: (c) => {
1385
+ return classifyTime(c.updatedAt);
1386
+ }
1387
+ });
1388
+ favorite.list.items = resultItems;
1377
1389
  } finally {
1378
1390
  favorite.loading = false;
1379
1391
  }
@@ -2262,10 +2274,11 @@ window._iconfont_svg_string_5021436 = '<svg><symbol id="icon-Ollama" viewBox="0
2262
2274
  // src/components/IconFont/index.ts
2263
2275
  var IconFont = icons.createFromIconfontCN({});
2264
2276
  var IconFont_default = IconFont;
2265
- var ConversationFavoritesBtn_default = ({ icon, ...rest }) => {
2277
+ var ConversationFavoritesBtn_default = ({ icon, disabled, ...rest }) => {
2266
2278
  const chatStore = useChatStore();
2267
2279
  const conversationsState = valtio.useSnapshot(chatStore.conversations);
2268
2280
  const conversationState = valtio.useSnapshot(chatStore.conversation);
2281
+ const activeMessages = conversationState.messages[conversationState.active.id]?.message;
2269
2282
  const activeConversation = React10.useMemo(() => {
2270
2283
  return conversationsState.list.items.find((item) => item.id === conversationState.active.id);
2271
2284
  }, [conversationsState.list.items, conversationState.active.id]);
@@ -2280,17 +2293,18 @@ var ConversationFavoritesBtn_default = ({ icon, ...rest }) => {
2280
2293
  title: isFavorite ? "\u53D6\u6D88\u6536\u85CF" : "\u6536\u85CF",
2281
2294
  type: "text",
2282
2295
  size: "large",
2283
- disabled: !conversationState.active.id,
2296
+ disabled: disabled || !conversationState.active.id || !activeMessages?.length,
2284
2297
  icon: icon?.() || (isFavorite ? /* @__PURE__ */ jsxRuntime.jsx(icons.StarFilled, { className: "primary-text" }) : /* @__PURE__ */ jsxRuntime.jsx(icons.StarOutlined, {})),
2285
2298
  onClick: handleToggleFavorite,
2286
2299
  ...rest
2287
2300
  }
2288
2301
  );
2289
2302
  };
2290
- var ConversationShareBtn_default = ({ icon, ...rest }) => {
2303
+ var ConversationShareBtn_default = ({ icon, disabled, ...rest }) => {
2291
2304
  const chatStore = useChatStore();
2292
2305
  const conversationState = valtio.useSnapshot(chatStore.conversation);
2293
2306
  const configState = valtio.useSnapshot(chatStore.config);
2307
+ const activeMessages = conversationState.messages[conversationState.active.id]?.message;
2294
2308
  const handleShareConversation = async () => {
2295
2309
  const { data } = await configState.services.request.shareConversation(conversationState.active.id);
2296
2310
  if (data) {
@@ -2303,7 +2317,7 @@ var ConversationShareBtn_default = ({ icon, ...rest }) => {
2303
2317
  title: "\u5206\u4EAB",
2304
2318
  type: "text",
2305
2319
  size: "large",
2306
- disabled: !conversationState.active.id,
2320
+ disabled: disabled || !conversationState.active.id || !activeMessages?.length,
2307
2321
  icon: icon?.() || /* @__PURE__ */ jsxRuntime.jsx(icons.ShareAltOutlined, {}),
2308
2322
  ...rest,
2309
2323
  onClick: handleShareConversation
@@ -2324,12 +2338,8 @@ var styles_module_default2 = {
2324
2338
  chatHeaderBtnGroup: "styles_module_chatHeaderBtnGroup",
2325
2339
  conversationListPanel: "styles_module_conversationListPanel",
2326
2340
  createConversationButton: "styles_module_createConversationButton",
2327
- conversationListContent: "styles_module_conversationListContent",
2328
2341
  conversations: "styles_module_conversations",
2329
- conversationTabs: "styles_module_conversationTabs",
2330
- conversationTabPane: "styles_module_conversationTabPane",
2331
2342
  conversationEmpty: "styles_module_conversationEmpty",
2332
- conversationScrollArea: "styles_module_conversationScrollArea",
2333
2343
  chatWelcomeWrap: "styles_module_chatWelcomeWrap",
2334
2344
  chatWelcome: "styles_module_chatWelcome",
2335
2345
  promptItem: "styles_module_promptItem",
@@ -2346,30 +2356,43 @@ var styles_module_default2 = {
2346
2356
  senderReferenceHeaderTitle: "styles_module_senderReferenceHeaderTitle",
2347
2357
  senderReferenceHeaderContent: "styles_module_senderReferenceHeaderContent"
2348
2358
  };
2349
- var ConversationList_default = () => {
2359
+ var ConversationTabPane = ({ items, activeKey, emptyDescription, scrollableTarget, menu, onActiveChange }) => {
2360
+ 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(
2361
+ InfiniteScroll__default.default,
2362
+ {
2363
+ dataLength: items.length,
2364
+ hasMore: false,
2365
+ next: () => {
2366
+ console2__default.default.log("next");
2367
+ },
2368
+ loader: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-center", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { indicator: /* @__PURE__ */ jsxRuntime.jsx(icons.RedoOutlined, { spin: true }), size: "small" }) }),
2369
+ style: { overflow: "hidden" },
2370
+ scrollableTarget,
2371
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2372
+ xV2.Conversations,
2373
+ {
2374
+ className: styles_module_default2.conversations,
2375
+ items,
2376
+ activeKey,
2377
+ onActiveChange: async (id) => onActiveChange(id),
2378
+ groupable: true,
2379
+ menu
2380
+ }
2381
+ )
2382
+ }
2383
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default2.conversationEmpty, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: emptyDescription, image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) });
2384
+ };
2385
+ var ConversationList_default = ({ onClose }) => {
2350
2386
  const chatStore = useChatStore();
2351
- const agentState = valtio.useSnapshot(chatStore.agent);
2352
2387
  const conversationsState = valtio.useSnapshot(chatStore.conversations);
2353
2388
  const conversationState = valtio.useSnapshot(chatStore.conversation);
2354
2389
  const favoriteState = valtio.useSnapshot(chatStore.favorite);
2355
2390
  const [activeTabKey, setActiveTabKey] = React10.useState("history");
2356
- React10.useEffect(() => {
2357
- if (!agentState.agentInfo.id) return;
2358
- chatStore.getConversationFavorite();
2359
- }, [agentState.agentInfo.id, chatStore]);
2360
2391
  const conversationList = React10.useMemo(() => {
2361
2392
  return conversationsState.list.items.filter((item) => item.label);
2362
2393
  }, [conversationsState.list.items]);
2363
2394
  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
- }));
2395
+ return favoriteState.list.items.filter((item) => item.label);
2373
2396
  }, [favoriteState.list.items]);
2374
2397
  const historyMenuConfig = (conversation) => ({
2375
2398
  items: [
@@ -2389,6 +2412,7 @@ var ConversationList_default = () => {
2389
2412
  itemInfo.domEvent.stopPropagation();
2390
2413
  if (itemInfo.key === "deleteChat") {
2391
2414
  chatStore.delConversation(conversation.key);
2415
+ onClose?.();
2392
2416
  } else if (itemInfo.key === "collect") {
2393
2417
  chatStore.collectConversation(conversation.id, !conversation.isFavorite);
2394
2418
  }
@@ -2410,7 +2434,7 @@ var ConversationList_default = () => {
2410
2434
  children: /* @__PURE__ */ jsxRuntime.jsx(
2411
2435
  antd.Button,
2412
2436
  {
2413
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.DeleteOutlined, {}),
2437
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.StarFilled, { className: "primary-text" }),
2414
2438
  title: "\u53D6\u6D88\u6536\u85CF",
2415
2439
  type: "text",
2416
2440
  onClick: (e) => {
@@ -2422,72 +2446,51 @@ 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) => {
2450
+ await chatStore.switchConversation(id);
2451
+ onClose?.();
2452
+ };
2453
+ return /* @__PURE__ */ jsxRuntime.jsx(
2426
2454
  antd.Tabs,
2427
2455
  {
2428
2456
  activeKey: activeTabKey,
2429
2457
  centered: true,
2458
+ className: "full-tabs",
2430
2459
  onChange: setActiveTabKey,
2431
2460
  items: [
2432
2461
  {
2433
2462
  key: "history",
2434
2463
  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,
2464
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2465
+ ConversationTabPane,
2437
2466
  {
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" },
2467
+ items: conversationList,
2468
+ activeKey: conversationState.active.id,
2469
+ emptyDescription: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55",
2445
2470
  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
- )
2471
+ menu: historyMenuConfig,
2472
+ onActiveChange: handleConversationChange
2457
2473
  }
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 }) }) })
2474
+ )
2459
2475
  },
2460
2476
  {
2461
2477
  key: "favorite",
2462
2478
  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,
2479
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2480
+ ConversationTabPane,
2465
2481
  {
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" },
2482
+ items: favoriteConversationList,
2483
+ activeKey: conversationState.active.id,
2484
+ emptyDescription: "\u6682\u65E0\u6536\u85CF\u4F1A\u8BDD",
2473
2485
  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
- )
2486
+ menu: favoriteMenuConfig,
2487
+ onActiveChange: handleConversationChange
2485
2488
  }
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 }) }) })
2489
+ )
2487
2490
  }
2488
2491
  ]
2489
2492
  }
2490
- ) });
2493
+ );
2491
2494
  };
2492
2495
 
2493
2496
  // src/ui/common/FeatureComponents/style.module.less
@@ -2524,13 +2527,25 @@ var style_module_default = {
2524
2527
  footer: "style_module_footer",
2525
2528
  titleContainer: "style_module_titleContainer"};
2526
2529
  var HistoryBtn_default = ({ icon, ...rest }) => {
2530
+ const chatStore = useChatStore();
2531
+ const agentState = valtio.useSnapshot(chatStore.agent);
2532
+ const [open, setOpen] = React10.useState(false);
2533
+ const handleOpenChange = (open2) => {
2534
+ setOpen(open2);
2535
+ if (open2 && agentState.agentInfo.id) {
2536
+ chatStore.getConversations(agentState.agentInfo.id);
2537
+ chatStore.getConversationFavorite();
2538
+ }
2539
+ };
2527
2540
  return /* @__PURE__ */ jsxRuntime.jsx(
2528
2541
  antd.Popover,
2529
2542
  {
2543
+ open,
2530
2544
  getPopupContainer: (e) => e,
2545
+ onOpenChange: handleOpenChange,
2531
2546
  placement: "bottom",
2532
2547
  classNames: { container: style_module_default.popover },
2533
- content: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}),
2548
+ content: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, { onClose: () => setOpen(false) }),
2534
2549
  trigger: ["click"],
2535
2550
  children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { title: "\u5386\u53F2\u4F1A\u8BDD", size: "large", type: "text", icon: icon?.() || /* @__PURE__ */ jsxRuntime.jsx(icons.CommentOutlined, {}), ...rest })
2536
2551
  }
@@ -2621,9 +2636,9 @@ var ConversationListHeader_default = ({ title = true, avatar = true, newConversa
2621
2636
  ] });
2622
2637
  };
2623
2638
  var ConversationListPanel = ({ header }) => {
2624
- return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
2639
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames2__default.default("height-full", "zero-chat-conversations", styles_module_default2.conversationListPanel), children: [
2625
2640
  /* @__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, {}) })
2641
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
2627
2642
  ] });
2628
2643
  };
2629
2644
  var ConversationListPanel_default = ConversationListPanel;
@@ -5190,6 +5205,34 @@ ${resultContent.text}
5190
5205
  ] });
5191
5206
  };
5192
5207
  var default_render_default = DefaultToolRender;
5208
+ var MAX_NESTING_DEPTH = 3;
5209
+ var SubAgentRender = ({ item }) => {
5210
+ const subMessages = item.subMessages || [];
5211
+ const depth = subMessages[0]?.subAgentDepth || 1;
5212
+ if (!subMessages.length) {
5213
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { type: "secondary", className: index_module_default2.emptyText, children: "\u5B50\u667A\u80FD\u4F53\u6267\u884C\u4E2D..." });
5214
+ }
5215
+ if (depth > MAX_NESTING_DEPTH) {
5216
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Typography.Text, { type: "secondary", className: index_module_default2.emptyText, children: [
5217
+ "\u5B50\u667A\u80FD\u4F53\u6267\u884C\u5185\u5BB9\uFF08\u5D4C\u5957\u5C42\u7EA7 ",
5218
+ depth,
5219
+ "\uFF0C\u5DF2\u6298\u53E0\uFF09"
5220
+ ] });
5221
+ }
5222
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: index_module_default2.subAgentContainer, children: [
5223
+ item.subAgentName && /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.subAgentHeader, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Typography.Text, { type: "secondary", className: index_module_default2.subAgentName, children: item.subAgentName }) }),
5224
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: index_module_default2.subAgentMessages, children: subMessages.map((msg, index) => /* @__PURE__ */ jsxRuntime.jsx(
5225
+ MessageRender_default,
5226
+ {
5227
+ role: { user: "agent", role: 2, placement: "start" },
5228
+ message: msg,
5229
+ loading: !!msg.generating
5230
+ },
5231
+ `sub-agent-${msg.messageId || index}`
5232
+ )) })
5233
+ ] });
5234
+ };
5235
+ var sub_agent_render_default = SubAgentRender;
5193
5236
  var TodoWriteRender = ({ args, result }) => {
5194
5237
  const { token } = antd.theme.useToken();
5195
5238
  const todos = Array.isArray(result) ? result : result?.todos || (Array.isArray(args) ? args : args?.todos) || [];
@@ -5221,21 +5264,30 @@ var TodoWriteRender = ({ args, result }) => {
5221
5264
  );
5222
5265
  };
5223
5266
  var todo_write_render_default = TodoWriteRender;
5267
+
5268
+ // src/components/CustomComponents/ToolRenders/index.tsx
5224
5269
  var toolRenders = {
5225
5270
  todo_write: {
5226
5271
  component: todo_write_render_default,
5227
- defaultExpanded: false,
5272
+ defaultExpanded: true,
5228
5273
  alwaysShowContent: (args, result) => {
5229
5274
  const todos = Array.isArray(result) ? result : result?.todos || (Array.isArray(args) ? args : args?.todos) || [];
5230
- return todos && todos.length > 0;
5275
+ return Array.isArray(todos) && todos.length > 0;
5231
5276
  },
5232
5277
  hideStatus: true,
5233
5278
  disableExpandOnError: true
5234
5279
  }
5235
5280
  };
5236
- var getToolRenderConfig = (toolName) => {
5237
- if (toolName && toolRenders[toolName]) {
5238
- return toolRenders[toolName];
5281
+ var getToolRenderConfig = (item) => {
5282
+ if (item?.hasSubAgent && item?.subMessages?.length) {
5283
+ return {
5284
+ component: sub_agent_render_default,
5285
+ defaultExpanded: true,
5286
+ alwaysShowContent: true
5287
+ };
5288
+ }
5289
+ if (item?.toolName && toolRenders[item.toolName]) {
5290
+ return toolRenders[item.toolName];
5239
5291
  }
5240
5292
  return {
5241
5293
  component: default_render_default,
@@ -5974,18 +6026,18 @@ var ModelSelect_default = ({}) => {
5974
6026
  icon: item.icon,
5975
6027
  options: item.models.map((model) => ({
5976
6028
  label: model.modelLabel,
5977
- value: model.modelName,
6029
+ value: `${item.providerName}:${model.modelName}`,
6030
+ modelName: model.modelName,
5978
6031
  providerName: item.providerName,
5979
6032
  icon: model.icon
5980
6033
  }))
5981
6034
  }));
5982
- const selectedModelValue = modelOptions.find((item) => item.value === agentState.model.providerName)?.options.find((item) => item.value === agentState.model.modelName)?.value || void 0;
6035
+ const selectedModelValue = modelOptions.find((item) => item.value === agentState.model.providerName)?.options.find((item) => item.modelName === agentState.model.modelName)?.value;
5983
6036
  React10.useEffect(() => {
5984
6037
  if (!selectedModelValue && models.length > 0 && models[0].models?.length > 0) {
5985
6038
  const firstProvider = models[0];
5986
6039
  const firstModel = firstProvider.models[0];
5987
6040
  chatStore.setAgentModel({
5988
- ...agentState.model,
5989
6041
  modelName: firstModel.modelName,
5990
6042
  providerName: firstProvider.providerName
5991
6043
  });
@@ -5994,15 +6046,13 @@ var ModelSelect_default = ({}) => {
5994
6046
  const handleModelChange = (_, option) => {
5995
6047
  if (Array.isArray(option) || !option || !("providerName" in option)) return;
5996
6048
  chatStore.setAgentModel({
5997
- ...agentState.model,
5998
- modelName: option.value,
6049
+ modelName: option.modelName,
5999
6050
  providerName: option.providerName
6000
6051
  });
6001
6052
  };
6002
6053
  const labelRender = (props) => {
6003
6054
  const currentVal = props.value;
6004
- const option = modelOptions.find((item) => item.options.some((model2) => model2.value === currentVal));
6005
- const model = option?.options.find((model2) => model2.value === currentVal);
6055
+ const model = modelOptions.flatMap((item) => item.options).find((model2) => model2.value === currentVal);
6006
6056
  if (!model) {
6007
6057
  return currentVal;
6008
6058
  }
@@ -6044,7 +6094,9 @@ var ReasonBtn_default = ({}) => {
6044
6094
  "div",
6045
6095
  {
6046
6096
  className: classNames2__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: agentState.model.reasoning }),
6047
- onClick: () => chatStore.setAgentModel({ ...agentState.model, reasoning: !agentState.model.reasoning }),
6097
+ onClick: () => chatStore.setAgentModel((prevModel) => ({
6098
+ reasoning: !prevModel.reasoning
6099
+ })),
6048
6100
  children: [
6049
6101
  /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
6050
6102
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u6DF1\u5EA6\u601D\u8003" })