@8btc/office-assistant-mcp 0.0.1 → 0.0.2

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # 财经报告 pdf 生成器 - mcp
1
+ # office 报告 pdf 生成器 - mcp
2
2
 
3
3
  - 用途:传入参数,mcp 中 tools 自动将数据转换成 html 模版,再使用 playwright 转换成 pdf。
4
4
  - 返回:pdf 文件本地绝对路径
package/dist/index.cjs CHANGED
@@ -149,7 +149,7 @@ const End = ({ data }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "f
149
149
  ] })
150
150
  ] });
151
151
  const Lv2Title = ({ children }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lv2Title flex items-start text-[18px] font-bold mb-[21px]", children: [
152
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mr-4 ml-1 h-7 flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
152
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mr-4 ml-1 h-[27px] flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
153
153
  "svg",
154
154
  {
155
155
  xmlns: "http://www.w3.org/2000/svg",
@@ -157,6 +157,7 @@ const Lv2Title = ({ children }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { clas
157
157
  height: "13",
158
158
  viewBox: "0 0 12 13",
159
159
  fill: "none",
160
+ className: "w-[10px] h-[12px]",
160
161
  children: /* @__PURE__ */ jsxRuntime.jsx(
161
162
  "path",
162
163
  {
@@ -52443,15 +52444,18 @@ const style = `/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com *
52443
52444
  .h-6 {
52444
52445
  height: calc(var(--spacing) * 6);
52445
52446
  }
52446
- .h-7 {
52447
- height: calc(var(--spacing) * 7);
52448
- }
52449
52447
  .h-8 {
52450
52448
  height: calc(var(--spacing) * 8);
52451
52449
  }
52452
52450
  .h-10 {
52453
52451
  height: calc(var(--spacing) * 10);
52454
52452
  }
52453
+ .h-\\[12px\\] {
52454
+ height: 12px;
52455
+ }
52456
+ .h-\\[27px\\] {
52457
+ height: 27px;
52458
+ }
52455
52459
  .h-\\[284px\\] {
52456
52460
  height: 284px;
52457
52461
  }
@@ -52473,6 +52477,9 @@ const style = `/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com *
52473
52477
  .w-80 {
52474
52478
  width: calc(var(--spacing) * 80);
52475
52479
  }
52480
+ .w-\\[10px\\] {
52481
+ width: 10px;
52482
+ }
52476
52483
  .w-\\[306px\\] {
52477
52484
  width: 306px;
52478
52485
  }
@@ -53716,6 +53723,7 @@ code {
53716
53723
  .pdf-columns-2 {
53717
53724
  columns: 2;
53718
53725
  column-fill: balance;
53726
+ column-gap: 32px;
53719
53727
  }
53720
53728
  mjx-container:not([display='true']) svg {
53721
53729
  display: inline !important;
@@ -53956,17 +53964,21 @@ async function generateBasePdf(data) {
53956
53964
  html: renderCover(data)
53957
53965
  },
53958
53966
  ...data.paragraph.map((it, idx) => ({
53959
- html: renderSegment({ ...it, abstract: idx === 0 ? data.abstract : "" })
53967
+ html: renderSegment({ ...it, abstract: idx === 0 ? data.abstract : "" }),
53968
+ headerTitle: data.header,
53969
+ footerTitle: data.footer
53960
53970
  })),
53961
53971
  data.reference && {
53962
- html: renderReference(data)
53972
+ html: renderReference(data),
53973
+ headerTitle: data.header,
53974
+ footerTitle: data.footer
53963
53975
  },
53964
53976
  {
53965
53977
  hideHeader: true,
53966
53978
  hideFooter: true,
53967
53979
  html: renderEnd(data)
53968
53980
  }
53969
- ];
53981
+ ].filter((it) => !!it);
53970
53982
  }
53971
53983
  const renderCover = (data) => {
53972
53984
  const seg = ReactDOMServer.renderToString(/* @__PURE__ */ jsxRuntime.jsx(Cover, { data }));
@@ -54080,7 +54092,6 @@ const createPage = async (page, item) => {
54080
54092
  tempFileName,
54081
54093
  headerTitle,
54082
54094
  html: html2,
54083
- headerSubTitle,
54084
54095
  footerTitle,
54085
54096
  hideHeader,
54086
54097
  hideFooter
@@ -54123,8 +54134,6 @@ async function mergePDFsWithPageNumbers({
54123
54134
  pageInfoList,
54124
54135
  page,
54125
54136
  dirname,
54126
- headerSubTitle,
54127
- footerTitle,
54128
54137
  renderCatalogue
54129
54138
  }) {
54130
54139
  const mergedPdf = await pdfLib.PDFDocument.create();
@@ -54164,9 +54173,7 @@ async function mergePDFsWithPageNumbers({
54164
54173
  html: renderCatalogue?.(
54165
54174
  Object.keys(menuStartPage).map((key) => menuStartPage[key])
54166
54175
  ),
54167
- tempFileName: `${dirname}/menu.pdf`,
54168
- headerSubTitle,
54169
- footerTitle
54176
+ tempFileName: `${dirname}/menu.pdf`
54170
54177
  };
54171
54178
  const menuBytes = await createPage(page, menuItem);
54172
54179
  const menuDoc = await pdfLib.PDFDocument.load(menuBytes);
@@ -54210,10 +54217,7 @@ const loadPdf = async (inputPath) => {
54210
54217
  const createPages = async ({
54211
54218
  list: list2,
54212
54219
  dirname,
54213
- headerSubTitle,
54214
- footerTitle,
54215
- createPage: createPage2,
54216
- title
54220
+ createPage: createPage2
54217
54221
  }) => {
54218
54222
  const browser = await playwright.chromium.launch();
54219
54223
  const context = await browser.newContext();
@@ -54229,10 +54233,7 @@ const createPages = async ({
54229
54233
  tempFiles.push(tempFileName);
54230
54234
  const pageRes = list2[i].pdfUrl ? await loadPdf(list2[i].pdfUrl) : await createPage2(page, {
54231
54235
  tempFileName,
54232
- headerSubTitle,
54233
- footerTitle,
54234
- ...list2[i],
54235
- headerTitle: title
54236
+ ...list2[i]
54236
54237
  });
54237
54238
  pageInfoList.push({
54238
54239
  ...list2[i],
@@ -54264,9 +54265,7 @@ async function generatePDF(params) {
54264
54265
  pageInfoList,
54265
54266
  outputPath,
54266
54267
  page,
54267
- dirname,
54268
- headerSubTitle: params.headerSubTitle,
54269
- footerTitle: params.footerTitle
54268
+ dirname
54270
54269
  });
54271
54270
  console.log("PDF生成完成,每页拥有不同的页眉标题!");
54272
54271
  } finally {
@@ -54285,12 +54284,10 @@ const tool = {
54285
54284
  const toolHandler = async (args) => {
54286
54285
  try {
54287
54286
  logger.info(`start: ${(/* @__PURE__ */ new Date()).getTime()}`);
54288
- const resp = await generateBasePdf(args);
54287
+ const generatedTemplates = await generateBasePdf(args);
54289
54288
  const pdfUrl = await generatePDF({
54290
- list: resp,
54291
- title: args.reportTitle || "2025-2026 全球 AIGC 产业发展现状与未来趋势深度洞察报告",
54292
- headerSubTitle: `2025-2026 全球 AIGC 产业发展现状与未来趋势深度洞察报告`,
54293
- footerTitle: "本报告由 Wujie Agent 生成",
54289
+ list: generatedTemplates,
54290
+ title: args.reportTitle,
54294
54291
  createPage
54295
54292
  });
54296
54293
  logger.info(`end: ${(/* @__PURE__ */ new Date()).getTime()}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@8btc/office-assistant-mcp",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "办公agent辅助mcp工具",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",