@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.esm.js CHANGED
@@ -168,15 +168,16 @@ var init_MdEdit = __esm({
168
168
  MdEdit_default = ({ data, loading }) => {
169
169
  const chatStore = useChatStore();
170
170
  const [value, setValue] = useState("");
171
+ const btnText = data.btnText || "\u7EE7\u7EED";
171
172
  const onOk = () => {
172
- chatStore.sendMessage("\u5F00\u59CB\u5199\u4F5C", [], { citation: value });
173
+ chatStore.sendMessage(btnText, [], { citation: value });
173
174
  };
174
175
  useEffect(() => {
175
176
  setValue(data.content);
176
177
  }, [data.content]);
177
178
  return /* @__PURE__ */ jsxs("div", { className: styles_module_default.mdEdit, children: [
178
179
  /* @__PURE__ */ jsx(MarkdownEditor, { disabled: loading, value, onChange: setValue, showToolbar: false }),
179
- !loading && /* @__PURE__ */ jsx(Flex, { justify: "end", className: "m-t-16", children: /* @__PURE__ */ jsx(Button, { color: "primary", variant: "outlined", onClick: onOk, children: "\u786E\u8BA4\u63D0\u7EB2\u601D\u8DEF\uFF0C\u5F00\u59CB\u5199\u4F5C" }) })
180
+ !loading && /* @__PURE__ */ jsx(Flex, { justify: "end", className: "m-t-16", children: /* @__PURE__ */ jsx(Button, { color: "primary", variant: "outlined", onClick: onOk, children: btnText }) })
180
181
  ] });
181
182
  };
182
183
  }
@@ -874,7 +875,6 @@ function createChatStore() {
874
875
  await config.services.request.conversationMessageSend(sendParams);
875
876
  config.hooks?.onAfterSend?.();
876
877
  } finally {
877
- conversation.messages[conversationId].loading = false;
878
878
  }
879
879
  };
880
880
  const cancelReceive = async () => {
@@ -906,7 +906,6 @@ function createChatStore() {
906
906
  conversation.messages[msg.conversationId].loading = true;
907
907
  messages[idx] = {
908
908
  ...messages[idx],
909
- params: messages[idx]?.params || msg.params,
910
909
  type: msg.type,
911
910
  tempContent: msg.msgContent
912
911
  };
@@ -918,7 +917,9 @@ function createChatStore() {
918
917
  conversation.messages[msg.conversationId].loading = true;
919
918
  messages[idx] = {
920
919
  ...messages[idx],
920
+ msgFiles: messages[idx]?.msgFiles?.length ? messages[idx].msgFiles : msg.msgFiles,
921
921
  params: messages[idx]?.params || msg.params,
922
+ quoteMsg: messages[idx]?.quoteMsg || msg.quoteMsg,
922
923
  type: msg.type,
923
924
  tempContent: "",
924
925
  msgContent: messages[idx].msgContent + (msg.msgContent || "")
@@ -940,6 +941,7 @@ function createChatStore() {
940
941
  const messages = conversation.messages[msg.conversationId]?.message;
941
942
  const idx = findMsgIndex(msg.id, messages);
942
943
  if (idx === -1) return;
944
+ conversation.messages[msg.conversationId].loading = true;
943
945
  messages[idx] = {
944
946
  ...messages[idx],
945
947
  citations: msg.msgContent
@@ -951,12 +953,10 @@ function createChatStore() {
951
953
  if (idx === -1) return;
952
954
  messages[idx] = {
953
955
  ...messages[idx],
954
- params: messages[idx]?.params || msg.params,
955
956
  tempContent: msg.msgContent,
956
957
  type: void 0,
957
958
  // 报错后清空消息内容
958
- msgContent: "",
959
- citations: ""
959
+ msgContent: ""
960
960
  };
961
961
  conversation.messages[msg.conversationId].loading = false;
962
962
  };