@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.cjs.js
CHANGED
|
@@ -144,20 +144,20 @@ var init_IndexQuote = __esm({
|
|
|
144
144
|
citations = JSON.parse(message2.citations);
|
|
145
145
|
} catch (e) {
|
|
146
146
|
}
|
|
147
|
-
return citations
|
|
147
|
+
return citations?.find((item) => String(item.citationId) === String(data.citationId));
|
|
148
148
|
}, [data.citationId, message2.citations]);
|
|
149
149
|
const onClick = () => {
|
|
150
|
-
if (!citation
|
|
150
|
+
if (!citation?.citationUrl) return;
|
|
151
151
|
if (common.isExternal(citation.citationUrl)) {
|
|
152
152
|
window.open(citation.citationUrl, "_blank");
|
|
153
153
|
} else {
|
|
154
154
|
setOpen(true);
|
|
155
155
|
}
|
|
156
156
|
};
|
|
157
|
-
const Content = /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", gap: 8, children: /* @__PURE__ */ jsxRuntime.jsx("a", { onClick, children: citation
|
|
157
|
+
const Content = /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", gap: 8, children: /* @__PURE__ */ jsxRuntime.jsx("a", { onClick, children: citation?.citationName }) }) });
|
|
158
158
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-block m-l-8", children: [
|
|
159
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Popover, { content: Content, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { bordered: false, color: "processing", className: "cursor-pointer", children: data
|
|
160
|
-
open && /* @__PURE__ */ jsxRuntime.jsx(DocDrawer_default, { paramsStr: citation
|
|
159
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Popover, { content: Content, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { bordered: false, color: "processing", className: "cursor-pointer", children: data?.citationName }) }) }),
|
|
160
|
+
open && /* @__PURE__ */ jsxRuntime.jsx(DocDrawer_default, { paramsStr: citation?.citationUrl, title: citation?.citationName, open, onClose: () => setOpen(false) })
|
|
161
161
|
] });
|
|
162
162
|
};
|
|
163
163
|
}
|
|
@@ -177,7 +177,7 @@ var init_MdEdit = __esm({
|
|
|
177
177
|
const chatStore = useChatStore();
|
|
178
178
|
const [value, setValue] = react.useState("");
|
|
179
179
|
const onOk = () => {
|
|
180
|
-
chatStore.sendMessage("\u5F00\u59CB\u5199\u4F5C", [], {
|
|
180
|
+
chatStore.sendMessage("\u5F00\u59CB\u5199\u4F5C", [], { citation: value });
|
|
181
181
|
};
|
|
182
182
|
react.useEffect(() => {
|
|
183
183
|
setValue(data.content);
|
|
@@ -1088,13 +1088,13 @@ var MessageRender_default = ({ message: message2, placement }) => {
|
|
|
1088
1088
|
() => `${message2.msgContent || ""}${message2.msgContent && message2.tempContent ? "\n\n" : ""}${message2.tempContent || ""}`,
|
|
1089
1089
|
[message2.msgContent, message2.tempContent]
|
|
1090
1090
|
);
|
|
1091
|
-
const
|
|
1092
|
-
let
|
|
1091
|
+
const paramsCitation = react.useMemo(() => {
|
|
1092
|
+
let citation = "";
|
|
1093
1093
|
try {
|
|
1094
|
-
|
|
1094
|
+
citation = JSON.parse(message2.params || "{}").citation || "";
|
|
1095
1095
|
} catch (e) {
|
|
1096
1096
|
}
|
|
1097
|
-
return
|
|
1097
|
+
return citation;
|
|
1098
1098
|
}, [message2.params]);
|
|
1099
1099
|
return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, children: !(message2.msgContent || message2.tempContent || message2.msgFiles.length) ? /* @__PURE__ */ jsxRuntime.jsx(antd.Typography, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { size: "small" }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1100
1100
|
content && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1133,7 +1133,7 @@ var MessageRender_default = ({ message: message2, placement }) => {
|
|
|
1133
1133
|
content: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [
|
|
1134
1134
|
message2.quoteMsg.msgContent && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
1135
1135
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
1136
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: "text-ellipsis", children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderMarkdown, { content: message2.quoteMsg.msgContent }) })
|
|
1136
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: "text-ellipsis", title: message2.quoteMsg.msgContent, children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderMarkdown, { content: message2.quoteMsg.msgContent }) })
|
|
1137
1137
|
] }),
|
|
1138
1138
|
message2.quoteMsg?.msgFiles && message2.quoteMsg.msgFiles.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
1139
1139
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u3010\u5F15\u7528\u6587\u4EF6\u3011\uFF1A" }),
|
|
@@ -1151,14 +1151,14 @@ var MessageRender_default = ({ message: message2, placement }) => {
|
|
|
1151
1151
|
] })
|
|
1152
1152
|
] })
|
|
1153
1153
|
}
|
|
1154
|
-
) :
|
|
1154
|
+
) : paramsCitation && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1155
1155
|
x.Bubble,
|
|
1156
1156
|
{
|
|
1157
1157
|
className: classNames9__default.default(styles_module_default2.chatQuoteMsg),
|
|
1158
1158
|
placement,
|
|
1159
1159
|
content: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 8, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
|
|
1160
1160
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "\u3010\u5F15\u7528\u6D88\u606F\u3011\uFF1A" }),
|
|
1161
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: "text-ellipsis", children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderMarkdown, { content:
|
|
1161
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { flex: 1, className: "text-ellipsis", title: paramsCitation, children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderMarkdown, { content: paramsCitation }) })
|
|
1162
1162
|
] }) })
|
|
1163
1163
|
}
|
|
1164
1164
|
)
|
|
@@ -2115,13 +2115,13 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
|
|
|
2115
2115
|
value: configState.preview.file.content,
|
|
2116
2116
|
onQuote: (text) => {
|
|
2117
2117
|
chatStore.setReferences({
|
|
2118
|
-
type:
|
|
2118
|
+
type: 2,
|
|
2119
2119
|
content: {
|
|
2120
2120
|
name: text,
|
|
2121
2121
|
markdown: text
|
|
2122
2122
|
},
|
|
2123
2123
|
params: {
|
|
2124
|
-
|
|
2124
|
+
citation: text
|
|
2125
2125
|
}
|
|
2126
2126
|
});
|
|
2127
2127
|
},
|