@zero-library/chat-agent 2.2.3 → 2.2.5

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 () => {
@@ -914,7 +914,6 @@ function createChatStore() {
914
914
  conversation.messages[msg.conversationId].loading = true;
915
915
  messages[idx] = {
916
916
  ...messages[idx],
917
- params: messages[idx]?.params || msg.params,
918
917
  type: msg.type,
919
918
  tempContent: msg.msgContent
920
919
  };
@@ -926,7 +925,9 @@ function createChatStore() {
926
925
  conversation.messages[msg.conversationId].loading = true;
927
926
  messages[idx] = {
928
927
  ...messages[idx],
928
+ msgFiles: messages[idx]?.msgFiles?.length ? messages[idx].msgFiles : msg.msgFiles,
929
929
  params: messages[idx]?.params || msg.params,
930
+ quoteMsg: messages[idx]?.quoteMsg || msg.quoteMsg,
930
931
  type: msg.type,
931
932
  tempContent: "",
932
933
  msgContent: messages[idx].msgContent + (msg.msgContent || "")
@@ -948,6 +949,7 @@ function createChatStore() {
948
949
  const messages = conversation.messages[msg.conversationId]?.message;
949
950
  const idx = findMsgIndex(msg.id, messages);
950
951
  if (idx === -1) return;
952
+ conversation.messages[msg.conversationId].loading = true;
951
953
  messages[idx] = {
952
954
  ...messages[idx],
953
955
  citations: msg.msgContent
@@ -959,12 +961,10 @@ function createChatStore() {
959
961
  if (idx === -1) return;
960
962
  messages[idx] = {
961
963
  ...messages[idx],
962
- params: messages[idx]?.params || msg.params,
963
964
  tempContent: msg.msgContent,
964
965
  type: void 0,
965
966
  // 报错后清空消息内容
966
- msgContent: "",
967
- citations: ""
967
+ msgContent: ""
968
968
  };
969
969
  conversation.messages[msg.conversationId].loading = false;
970
970
  };