@zero-library/chat-agent 2.2.2 → 2.2.3
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 +15 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +15 -15
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -136,20 +136,20 @@ var init_IndexQuote = __esm({
|
|
|
136
136
|
citations = JSON.parse(message2.citations);
|
|
137
137
|
} catch (e) {
|
|
138
138
|
}
|
|
139
|
-
return citations
|
|
139
|
+
return citations?.find((item) => String(item.citationId) === String(data.citationId));
|
|
140
140
|
}, [data.citationId, message2.citations]);
|
|
141
141
|
const onClick = () => {
|
|
142
|
-
if (!citation
|
|
142
|
+
if (!citation?.citationUrl) return;
|
|
143
143
|
if (isExternal(citation.citationUrl)) {
|
|
144
144
|
window.open(citation.citationUrl, "_blank");
|
|
145
145
|
} else {
|
|
146
146
|
setOpen(true);
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
|
-
const Content = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Flex, { align: "center", gap: 8, children: /* @__PURE__ */ jsx("a", { onClick, children: citation
|
|
149
|
+
const Content = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Flex, { align: "center", gap: 8, children: /* @__PURE__ */ jsx("a", { onClick, children: citation?.citationName }) }) });
|
|
150
150
|
return /* @__PURE__ */ jsxs("div", { className: "inline-block m-l-8", children: [
|
|
151
|
-
/* @__PURE__ */ jsx(Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsx(Popover, { content: Content, children: /* @__PURE__ */ jsx(Tag, { bordered: false, color: "processing", className: "cursor-pointer", children: data
|
|
152
|
-
open && /* @__PURE__ */ jsx(DocDrawer_default, { paramsStr: citation
|
|
151
|
+
/* @__PURE__ */ jsx(Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsx(Popover, { content: Content, children: /* @__PURE__ */ jsx(Tag, { bordered: false, color: "processing", className: "cursor-pointer", children: data?.citationName }) }) }),
|
|
152
|
+
open && /* @__PURE__ */ jsx(DocDrawer_default, { paramsStr: citation?.citationUrl, title: citation?.citationName, open, onClose: () => setOpen(false) })
|
|
153
153
|
] });
|
|
154
154
|
};
|
|
155
155
|
}
|
|
@@ -169,7 +169,7 @@ var init_MdEdit = __esm({
|
|
|
169
169
|
const chatStore = useChatStore();
|
|
170
170
|
const [value, setValue] = useState("");
|
|
171
171
|
const onOk = () => {
|
|
172
|
-
chatStore.sendMessage("\u5F00\u59CB\u5199\u4F5C", [], {
|
|
172
|
+
chatStore.sendMessage("\u5F00\u59CB\u5199\u4F5C", [], { citation: value });
|
|
173
173
|
};
|
|
174
174
|
useEffect(() => {
|
|
175
175
|
setValue(data.content);
|
|
@@ -1080,13 +1080,13 @@ var MessageRender_default = ({ message: message2, placement }) => {
|
|
|
1080
1080
|
() => `${message2.msgContent || ""}${message2.msgContent && message2.tempContent ? "\n\n" : ""}${message2.tempContent || ""}`,
|
|
1081
1081
|
[message2.msgContent, message2.tempContent]
|
|
1082
1082
|
);
|
|
1083
|
-
const
|
|
1084
|
-
let
|
|
1083
|
+
const paramsCitation = useMemo(() => {
|
|
1084
|
+
let citation = "";
|
|
1085
1085
|
try {
|
|
1086
|
-
|
|
1086
|
+
citation = JSON.parse(message2.params || "{}").citation || "";
|
|
1087
1087
|
} catch (e) {
|
|
1088
1088
|
}
|
|
1089
|
-
return
|
|
1089
|
+
return citation;
|
|
1090
1090
|
}, [message2.params]);
|
|
1091
1091
|
return /* @__PURE__ */ jsx(Flex, { vertical: true, children: !(message2.msgContent || message2.tempContent || message2.msgFiles.length) ? /* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx(Spin, { size: "small" }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1092
1092
|
content && /* @__PURE__ */ jsx(
|
|
@@ -1125,7 +1125,7 @@ var MessageRender_default = ({ message: message2, placement }) => {
|
|
|
1125
1125
|
content: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [
|
|
1126
1126
|
message2.quoteMsg.msgContent && /* @__PURE__ */ jsxs(Flex, { children: [
|
|
1127
1127
|
/* @__PURE__ */ jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
1128
|
-
/* @__PURE__ */ jsx(Flex, { flex: 1, className: "text-ellipsis", children: /* @__PURE__ */ jsx(RenderMarkdown, { content: message2.quoteMsg.msgContent }) })
|
|
1128
|
+
/* @__PURE__ */ jsx(Flex, { flex: 1, className: "text-ellipsis", title: message2.quoteMsg.msgContent, children: /* @__PURE__ */ jsx(RenderMarkdown, { content: message2.quoteMsg.msgContent }) })
|
|
1129
1129
|
] }),
|
|
1130
1130
|
message2.quoteMsg?.msgFiles && message2.quoteMsg.msgFiles.length > 0 && /* @__PURE__ */ jsxs(Flex, { children: [
|
|
1131
1131
|
/* @__PURE__ */ jsx("span", { children: "\u3010\u5F15\u7528\u6587\u4EF6\u3011\uFF1A" }),
|
|
@@ -1143,14 +1143,14 @@ var MessageRender_default = ({ message: message2, placement }) => {
|
|
|
1143
1143
|
] })
|
|
1144
1144
|
] })
|
|
1145
1145
|
}
|
|
1146
|
-
) :
|
|
1146
|
+
) : paramsCitation && /* @__PURE__ */ jsx(
|
|
1147
1147
|
Bubble,
|
|
1148
1148
|
{
|
|
1149
1149
|
className: classNames9(styles_module_default2.chatQuoteMsg),
|
|
1150
1150
|
placement,
|
|
1151
1151
|
content: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
1152
1152
|
/* @__PURE__ */ jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
1153
|
-
/* @__PURE__ */ jsx(Flex, { flex: 1, className: "text-ellipsis", children: /* @__PURE__ */ jsx(RenderMarkdown, { content:
|
|
1153
|
+
/* @__PURE__ */ jsx(Flex, { flex: 1, className: "text-ellipsis", title: paramsCitation, children: /* @__PURE__ */ jsx(RenderMarkdown, { content: paramsCitation }) })
|
|
1154
1154
|
] }) })
|
|
1155
1155
|
}
|
|
1156
1156
|
)
|
|
@@ -2107,13 +2107,13 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
|
|
|
2107
2107
|
value: configState.preview.file.content,
|
|
2108
2108
|
onQuote: (text) => {
|
|
2109
2109
|
chatStore.setReferences({
|
|
2110
|
-
type:
|
|
2110
|
+
type: 2,
|
|
2111
2111
|
content: {
|
|
2112
2112
|
name: text,
|
|
2113
2113
|
markdown: text
|
|
2114
2114
|
},
|
|
2115
2115
|
params: {
|
|
2116
|
-
|
|
2116
|
+
citation: text
|
|
2117
2117
|
}
|
|
2118
2118
|
});
|
|
2119
2119
|
},
|