@zero-library/chat-copilot 1.0.8 → 1.0.9

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
@@ -1160,7 +1160,7 @@ function createChatStore() {
1160
1160
  messages.push(finalMsg);
1161
1161
  } else {
1162
1162
  const prevContent = messages[idx]?.content || [];
1163
- messages[idx].content = [...prevContent, newMessage.content[0]];
1163
+ messages[idx].content = [...prevContent, ...newMessage.content];
1164
1164
  }
1165
1165
  conversation.messages[newMessage.conversationId].loading = true;
1166
1166
  break;
@@ -2076,6 +2076,44 @@ var FileView_default = ({ data, loading }) => {
2076
2076
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-ellipsis", title: data.fileName, children: data.fileName })
2077
2077
  ] }) });
2078
2078
  };
2079
+ var DocDrawer_default = ({ title, open, onClose, paramsStr }) => {
2080
+ const chatStore = useChatStore();
2081
+ valtio.useSnapshot(chatStore.config);
2082
+ const [content, setContent] = React6.useState("");
2083
+ const [loading, setLoading] = React6.useState(false);
2084
+ const getContent = async () => {
2085
+ try {
2086
+ setLoading(true);
2087
+ setContent("");
2088
+ } finally {
2089
+ setLoading(false);
2090
+ }
2091
+ };
2092
+ React6.useEffect(() => {
2093
+ getContent();
2094
+ }, [paramsStr]);
2095
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Drawer, { title, push: false, size: "100%", open, onClose, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, children: content ? /* @__PURE__ */ jsxRuntime.jsx(XMarkdown__default.default, { content }) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { className: "m-t-32" }) }) });
2096
+ };
2097
+ var IndexQuote_default = ({ data, loading, message: message3 }) => {
2098
+ const [open, setOpen] = React6.useState(false);
2099
+ const citation = React6.useMemo(() => {
2100
+ const citations = message3.content?.find((item) => item.type === "citation")?.citations ?? [];
2101
+ return citations?.find((item) => String(item.citationId) === String(data.citationId));
2102
+ }, [data.citationId, message3.content]);
2103
+ const onClick = () => {
2104
+ if (!citation?.citationUrl) return;
2105
+ if (common.isExternal(citation.citationUrl)) {
2106
+ window.open(citation.citationUrl, "_blank");
2107
+ } else {
2108
+ setOpen(true);
2109
+ }
2110
+ };
2111
+ 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 }) }) });
2112
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-block m-l-8", children: [
2113
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Popover, { content: Content, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { variant: "filled", color: "processing", className: "cursor-pointer", children: data?.citationName }) }) }),
2114
+ open && /* @__PURE__ */ jsxRuntime.jsx(DocDrawer_default, { paramsStr: citation?.citationUrl, title: citation?.citationName, open, onClose: () => setOpen(false) })
2115
+ ] });
2116
+ };
2079
2117
  var MdEdit_default = ({ data, loading }) => {
2080
2118
  const chatStore = useChatStore();
2081
2119
  const [value, setValue] = React6.useState("");
@@ -2133,6 +2171,9 @@ var PreviewLink_default = ({ data, loading, domNode, ...rest }) => {
2133
2171
  };
2134
2172
  return /* @__PURE__ */ jsxRuntime.jsx("a", { ...rest, onClick: handleClick, children: data });
2135
2173
  };
2174
+ var Think_default = ({ data }) => {
2175
+ return /* @__PURE__ */ jsxRuntime.jsx(xV2.Think, { title: "\u6DF1\u5EA6\u601D\u8003", className: "m-b-16", children: data });
2176
+ };
2136
2177
 
2137
2178
  // src/components/XMarkdown/styles.module.less
2138
2179
  var styles_module_default4 = {
@@ -2180,13 +2221,14 @@ var XMarkdown_default = ({ message: message3, components, content, ...rest }) =>
2180
2221
  const markdownComponents = React6.useMemo(
2181
2222
  () => adaptMarkdownComponents(
2182
2223
  {
2224
+ think: Think_default,
2183
2225
  code: CodeHighlight_default,
2184
2226
  agentnavigate: AgentNavigate_default,
2185
2227
  a: PreviewLink_default,
2186
2228
  appcard: AppCard_default,
2187
2229
  fileview: FileView_default,
2188
2230
  charts: Charts_default,
2189
- // indexquote: IndexQuote,
2231
+ indexquote: IndexQuote_default,
2190
2232
  mdedit: MdEdit_default,
2191
2233
  fileedit: FileEdit_default,
2192
2234
  ...components
@@ -2557,7 +2599,7 @@ var Button7 = ({ label, variant = "default", onClick, action, onAction }) => {
2557
2599
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: variant === "primary" ? "primary" : "default", danger: variant === "danger", onClick: handleClick, style: { borderRadius: 8 }, children: label });
2558
2600
  };
2559
2601
  var Divider = () => /* @__PURE__ */ jsxRuntime.jsx(antd.Divider, { style: { margin: "8px 0" } });
2560
- var Tag = ({ text, color }) => /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color, children: text });
2602
+ var Tag2 = ({ text, color }) => /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { color, children: text });
2561
2603
  var Progress = ({
2562
2604
  percent,
2563
2605
  status = "normal",
@@ -2575,7 +2617,7 @@ var A2uiComponents = {
2575
2617
  Switch,
2576
2618
  Button: Button7,
2577
2619
  Divider,
2578
- Tag,
2620
+ Tag: Tag2,
2579
2621
  Progress,
2580
2622
  ArtifactCard,
2581
2623
  TableViewer,