@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 +4 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +4 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
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(
|
|
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:
|
|
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 () => {
|
|
@@ -940,6 +940,7 @@ function createChatStore() {
|
|
|
940
940
|
const messages = conversation.messages[msg.conversationId]?.message;
|
|
941
941
|
const idx = findMsgIndex(msg.id, messages);
|
|
942
942
|
if (idx === -1) return;
|
|
943
|
+
conversation.messages[msg.conversationId].loading = true;
|
|
943
944
|
messages[idx] = {
|
|
944
945
|
...messages[idx],
|
|
945
946
|
citations: msg.msgContent
|