@zero-library/chat-agent 2.2.3 → 2.2.4

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
@@ -176,15 +176,16 @@ var init_MdEdit = __esm({
176
176
  MdEdit_default = ({ data, loading }) => {
177
177
  const chatStore = useChatStore();
178
178
  const [value, setValue] = react.useState("");
179
+ const btnText = data.btnText || "\u7EE7\u7EED";
179
180
  const onOk = () => {
180
- chatStore.sendMessage("\u5F00\u59CB\u5199\u4F5C", [], { citation: value });
181
+ chatStore.sendMessage(btnText, [], { citation: value });
181
182
  };
182
183
  react.useEffect(() => {
183
184
  setValue(data.content);
184
185
  }, [data.content]);
185
186
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default.mdEdit, children: [
186
187
  /* @__PURE__ */ jsxRuntime.jsx(common.MarkdownEditor, { disabled: loading, value, onChange: setValue, showToolbar: false }),
187
- !loading && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "end", className: "m-t-16", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "primary", variant: "outlined", onClick: onOk, children: "\u786E\u8BA4\u63D0\u7EB2\u601D\u8DEF\uFF0C\u5F00\u59CB\u5199\u4F5C" }) })
188
+ !loading && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "end", className: "m-t-16", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "primary", variant: "outlined", onClick: onOk, children: btnText }) })
188
189
  ] });
189
190
  };
190
191
  }
@@ -882,7 +883,6 @@ function createChatStore() {
882
883
  await config.services.request.conversationMessageSend(sendParams);
883
884
  config.hooks?.onAfterSend?.();
884
885
  } finally {
885
- conversation.messages[conversationId].loading = false;
886
886
  }
887
887
  };
888
888
  const cancelReceive = async () => {
@@ -948,6 +948,7 @@ function createChatStore() {
948
948
  const messages = conversation.messages[msg.conversationId]?.message;
949
949
  const idx = findMsgIndex(msg.id, messages);
950
950
  if (idx === -1) return;
951
+ conversation.messages[msg.conversationId].loading = true;
951
952
  messages[idx] = {
952
953
  ...messages[idx],
953
954
  citations: msg.msgContent