@8btc/office-assistant-mcp 0.0.11 → 0.0.12

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.
Files changed (2) hide show
  1. package/dist/index.cjs +14 -14
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -74950,16 +74950,16 @@ const CodeBlock = ({ inline, className, children, ...props }) => {
74950
74950
  }
74951
74951
  ) }) : /* @__PURE__ */ jsxRuntime.jsx("code", { ...props, className, children });
74952
74952
  };
74953
- const imgRegex = /!\[(.*?)\]\((.*?)\)/g;
74954
- const windowsPattern = /[a-zA-Z]:(?:\\|\/)[^\s"'`<>|?*]*(?:[\\/][^\s"'`<>|?*]*)*/g;
74955
74953
  const replaceMarkdown = (mdContent) => {
74956
- return mdContent.replaceAll(imgRegex, (m) => {
74957
- let match = imgRegex.exec(m);
74954
+ const imgRegex = /!\[(.*?)\]\((.*?)\)/g;
74955
+ const windowsPattern = /[a-zA-Z]:(?:\\|\/)[^\s"'`<>|?*]*(?:[\\/][^\s"'`<>|?*]*)*/g;
74956
+ return mdContent.replace(imgRegex, (m) => {
74957
+ let match;
74958
74958
  let result = "";
74959
- if (match) {
74959
+ while ((match = imgRegex.exec(m)) !== null) {
74960
74960
  const [, alt, src] = match;
74961
74961
  if (windowsPattern.test(src)) {
74962
- result = `![${alt || ""}](${encodeURIComponent(src)})`;
74962
+ result = `![${alt || ""}]("${encodeURIComponent(src)}")`;
74963
74963
  }
74964
74964
  }
74965
74965
  return result || m;
@@ -74979,7 +74979,9 @@ const MarkdownRenderer = (props) => {
74979
74979
  }
74980
74980
  ]
74981
74981
  ],
74982
- components: { code: CodeBlock },
74982
+ components: {
74983
+ code: CodeBlock
74984
+ },
74983
74985
  children: replaceMarkdown(markDownContent || "")
74984
74986
  }
74985
74987
  );
@@ -74992,7 +74994,7 @@ const Segment = ({ data }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className
74992
74994
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pdf-columns-2 markdown-body", children: [
74993
74995
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "lv1Title", children: data.title }),
74994
74996
  !!data.content && /* @__PURE__ */ jsxRuntime.jsx(MarkdownRenderer, { markDownContent: data.content }),
74995
- data.children?.map((it, idx) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
74997
+ data.childrens?.map((it, idx) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
74996
74998
  !!it.title && /* @__PURE__ */ jsxRuntime.jsx(Lv2Title, { children: it.title }),
74997
74999
  !!it.content && /* @__PURE__ */ jsxRuntime.jsx(MarkdownRenderer, { markDownContent: it.content })
74998
75000
  ] }, idx))
@@ -76907,7 +76909,7 @@ const renderEnd = (data) => {
76907
76909
  const paragraph = zod.z.object({
76908
76910
  title: zod.z.string().optional().describe("一级标题"),
76909
76911
  content: zod.z.string().optional().describe("内容"),
76910
- children: zod.z.array(
76912
+ childrens: zod.z.array(
76911
76913
  zod.z.object({
76912
76914
  title: zod.z.string().optional().describe("二级标题"),
76913
76915
  content: zod.z.string().optional().describe("内容")
@@ -76923,9 +76925,7 @@ const basePdfSchema = {
76923
76925
  footer: zod.z.string().describe("报告页脚内容"),
76924
76926
  reference: zod.z.string().describe("报告引用"),
76925
76927
  paragraph: zod.z.array(paragraph).describe("报告内容"),
76926
- disclaimer: zod.z.string().optional().describe("ai生成声明"),
76927
- // todo: delete
76928
- markdown: zod.z.string().optional().describe("markdown")
76928
+ disclaimer: zod.z.string().optional().describe("ai生成声明")
76929
76929
  };
76930
76930
  zod.z.object({
76931
76931
  ...basePdfSchema
@@ -77033,8 +77033,6 @@ const extractAllImageSrc = (html2) => {
77033
77033
  }
77034
77034
  return srcs;
77035
77035
  };
77036
- const reg = /<img[^>]+>/gi;
77037
- const regByGroup = /(<img[^>]*?)src=["'][^"']*["']([^>]*>)/gi;
77038
77036
  const createPage = async (page, item) => {
77039
77037
  const {
77040
77038
  tempFileName,
@@ -77067,11 +77065,13 @@ const createPage = async (page, item) => {
77067
77065
  })
77068
77066
  )
77069
77067
  );
77068
+ const reg = /<img[^>]+>/gi;
77070
77069
  const _html = html2.replaceAll(reg, (m) => {
77071
77070
  const item2 = localFileInfoList.find((info) => {
77072
77071
  return m.indexOf(info?.originSrc || "") !== -1;
77073
77072
  });
77074
77073
  if (item2) {
77074
+ const regByGroup = /(<img[^>]*?)src=["'][^"']*["']([^>]*>)/gi;
77075
77075
  return m.replace(regByGroup, `$1src="${item2.base64}"$2`);
77076
77076
  }
77077
77077
  return m;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@8btc/office-assistant-mcp",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "办公agent辅助mcp工具",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",