@zero-library/chat-copilot 3.1.28 → 3.1.30

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
@@ -72,7 +72,9 @@ function useChatStore() {
72
72
  // src/components/styles.module.less
73
73
  var styles_module_default = {
74
74
  chatAttachments: "styles_module_chatAttachments",
75
- chatSender: "styles_module_chatSender"};
75
+ chatSender: "styles_module_chatSender",
76
+ bubble: "styles_module_bubble"
77
+ };
76
78
  var Attachments_default = React10.forwardRef(({ fileUpload, fileUploadConfig, fileList = [], onChange, extraParams }, ref) => {
77
79
  const { message: message3 } = antd.App.useApp();
78
80
  const chatStore = useChatStore();
@@ -1193,18 +1195,6 @@ function createChatStore() {
1193
1195
  /** 智能体加载状态 */
1194
1196
  loading: false
1195
1197
  });
1196
- const setAgentModel = (updater) => {
1197
- const prevModel = agent.agentInfo.spec?.model || {
1198
- modelName: "",
1199
- providerName: "",
1200
- reasoning: true
1201
- };
1202
- const nextPatch = typeof updater === "function" ? updater(prevModel) : updater;
1203
- const nextSpec = common.deepCopy(agent.agentInfo.spec || {});
1204
- nextSpec.model = { ...prevModel, ...nextPatch };
1205
- agent.agentInfo.spec = nextSpec;
1206
- config.hooks?.onAfterSwitchModel?.(agent.agentInfo.spec.model);
1207
- };
1208
1198
  const getUserInput = async (agentId) => {
1209
1199
  agent.loading = true;
1210
1200
  try {
@@ -1226,19 +1216,19 @@ function createChatStore() {
1226
1216
  try {
1227
1217
  const { data } = await config.services.request.fetchAgentInfo(id || "");
1228
1218
  agent.agentInfo = data;
1229
- config.hooks?.onAfterSwitchAgent?.(agent.agentInfo);
1230
1219
  } finally {
1231
1220
  config.loading = false;
1232
1221
  }
1233
1222
  };
1234
1223
  const setAgent = async (agentInfo) => {
1235
- if (!agent.agentInfo.id && !agentInfo.updatedAt || agent.agentInfo.id !== agentInfo.id) {
1224
+ if (!agent.agentInfo.id && !agentInfo.updatedAt || agent.agentInfo.id && agent.agentInfo.id !== agentInfo.id) {
1236
1225
  await getAgentInfo(agentInfo.id);
1237
1226
  }
1238
1227
  agent.agentInfo = { ...agent.agentInfo, ...agentInfo };
1239
1228
  if (config.layout.userInput) {
1240
1229
  await getUserInput(agent.agentInfo.id);
1241
1230
  }
1231
+ config.hooks?.onAfterSwitchAgent?.(agent.agentInfo);
1242
1232
  };
1243
1233
  const conversations = valtio.proxy({
1244
1234
  /** 会话列表数据 */
@@ -2071,7 +2061,11 @@ function createChatStore() {
2071
2061
  files,
2072
2062
  spec: {
2073
2063
  ...conversation.active.spec,
2074
- model: agent.agentInfo.spec?.model
2064
+ model: {
2065
+ providerName: agent.agentInfo.spec?.model?.providerName || "",
2066
+ modelName: agent.agentInfo.spec?.model?.modelName || "",
2067
+ reasoning: agent.agentInfo.spec?.model?.reasoning ?? false
2068
+ }
2075
2069
  },
2076
2070
  stream: true,
2077
2071
  responseMode: 2
@@ -2140,8 +2134,6 @@ function createChatStore() {
2140
2134
  setServices,
2141
2135
  /** 智能体状态 */
2142
2136
  agent,
2143
- /** 设置智能体模型 */
2144
- setAgentModel,
2145
2137
  /** 设置文件预览 */
2146
2138
  setPreview,
2147
2139
  /** 设置参数 */
@@ -3136,7 +3128,7 @@ var CodeHighlight_default = ({ className, data }) => {
3136
3128
  overflowX: "auto",
3137
3129
  borderRadius: 8
3138
3130
  },
3139
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minWidth: "max-content" }, children: /* @__PURE__ */ jsxRuntime.jsx(xV2.CodeHighlighter, { lang, style: { margin: 0 }, children: data }) })
3131
+ children: /* @__PURE__ */ jsxRuntime.jsx(xV2.CodeHighlighter, { lang, style: { margin: 0 }, children: data })
3140
3132
  }
3141
3133
  );
3142
3134
  };
@@ -5080,7 +5072,7 @@ var index_module_default2 = {
5080
5072
  duration: "index_module_duration",
5081
5073
  toolNamePending: "index_module_toolNamePending",
5082
5074
  dot: "index_module_dot",
5083
- dotBlink: "index_module_dotBlink",
5075
+ "dot-blink": "index_module_dot-blink",
5084
5076
  expandIcon: "index_module_expandIcon",
5085
5077
  expanded: "index_module_expanded",
5086
5078
  contentScrollContainer: "index_module_contentScrollContainer",
@@ -5475,6 +5467,7 @@ var MessageRender_default = React10__namespace.default.memo(({ role, message: me
5475
5467
  {
5476
5468
  role: role.user,
5477
5469
  placement: role.placement,
5470
+ className: styles_module_default.bubble,
5478
5471
  variant: item.type === "files" ? "borderless" : void 0,
5479
5472
  content: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5480
5473
  (item.type === "toolCall" || item.type === "toolResult") && /* @__PURE__ */ jsxRuntime.jsx(tool_call_item_default, { item }, `tool-call-${item.toolCallId || index}`),
@@ -6022,16 +6015,16 @@ var ModelSelect_default = ({}) => {
6022
6015
  const currentModel = agentState.agentInfo.spec?.model;
6023
6016
  const updateAgentModel = React10.useCallback(
6024
6017
  (model) => {
6025
- const nextAgentInfo = common.deepCopy(agentState.agentInfo || {});
6026
- const nextSpec = common.deepCopy(agentState.agentInfo.spec || {});
6027
- nextSpec.model = {
6028
- modelName: "",
6029
- providerName: "",
6030
- reasoning: true,
6031
- ...nextSpec.model || {},
6032
- ...model
6018
+ const nextAgentInfo = {
6019
+ ...agentState.agentInfo,
6020
+ spec: {
6021
+ ...agentState.agentInfo.spec,
6022
+ model: {
6023
+ ...agentState.agentInfo.spec?.model,
6024
+ ...model
6025
+ }
6026
+ }
6033
6027
  };
6034
- nextAgentInfo.spec = nextSpec;
6035
6028
  chatStore.setAgent(nextAgentInfo);
6036
6029
  },
6037
6030
  [agentState.agentInfo, chatStore]
@@ -6094,34 +6087,27 @@ var ModelSelect_default = ({}) => {
6094
6087
  }
6095
6088
  );
6096
6089
  };
6097
- var ReasonBtn_default = ({}) => {
6090
+ var ReasonBtn_default = () => {
6098
6091
  const chatStore = useChatStore();
6099
6092
  const agentState = valtio.useSnapshot(chatStore.agent);
6100
6093
  const currentModel = agentState.agentInfo.spec?.model;
6101
- const updateAgentModel = (reasoning) => {
6102
- const nextAgentInfo = common.deepCopy(agentState.agentInfo || {});
6103
- const nextSpec = common.deepCopy(agentState.agentInfo.spec || {});
6104
- nextSpec.model = {
6105
- modelName: "",
6106
- providerName: "",
6107
- reasoning: true,
6108
- ...nextSpec.model || {}
6094
+ const toggleReasoning = () => {
6095
+ const nextAgentInfo = {
6096
+ ...agentState.agentInfo,
6097
+ spec: {
6098
+ ...agentState.agentInfo.spec,
6099
+ model: {
6100
+ ...agentState.agentInfo.spec?.model,
6101
+ reasoning: !currentModel?.reasoning
6102
+ }
6103
+ }
6109
6104
  };
6110
- nextSpec.model.reasoning = reasoning;
6111
- nextAgentInfo.spec = nextSpec;
6112
6105
  chatStore.setAgent(nextAgentInfo);
6113
6106
  };
6114
- return /* @__PURE__ */ jsxRuntime.jsxs(
6115
- "div",
6116
- {
6117
- className: classNames2__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: currentModel?.reasoning }),
6118
- onClick: () => updateAgentModel(!currentModel?.reasoning),
6119
- children: [
6120
- /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
6121
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u6DF1\u5EA6\u601D\u8003" })
6122
- ]
6123
- }
6124
- );
6107
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames2__default.default(style_module_default.resourceBtn, { [style_module_default.resourceBtnActive]: currentModel?.reasoning }), onClick: toggleReasoning, children: [
6108
+ /* @__PURE__ */ jsxRuntime.jsx(IconFont_default, { type: "icon-reason" }),
6109
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u6DF1\u5EA6\u601D\u8003" })
6110
+ ] });
6125
6111
  };
6126
6112
  var { Text: Text7 } = antd.Typography;
6127
6113
  var SkillBtn_default = ({}) => {