wps-multitool-mcp 0.0.0-stage → 1.0.1
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 +3 -3
- package/dist/bridge/cancellable.d.ts +36 -0
- package/dist/bridge/cancellable.d.ts.map +1 -0
- package/dist/bridge/cancellable.js +155 -0
- package/dist/bridge/cancellable.js.map +1 -0
- package/dist/bridge/index.d.ts +37 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +381 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/bridge/ps-child.d.ts +155 -0
- package/dist/bridge/ps-child.d.ts.map +1 -0
- package/dist/bridge/ps-child.js +578 -0
- package/dist/bridge/ps-child.js.map +1 -0
- package/dist/client/action-routes.d.ts +32 -0
- package/dist/client/action-routes.d.ts.map +1 -0
- package/dist/client/action-routes.generated.d.ts +10 -0
- package/dist/client/action-routes.generated.d.ts.map +1 -0
- package/dist/client/action-routes.generated.js +322 -0
- package/dist/client/action-routes.generated.js.map +1 -0
- package/dist/client/action-routes.js +57 -0
- package/dist/client/action-routes.js.map +1 -0
- package/dist/client/mac-poll-server.d.ts +77 -0
- package/dist/client/mac-poll-server.d.ts.map +1 -0
- package/dist/client/mac-poll-server.js +516 -0
- package/dist/client/mac-poll-server.js.map +1 -0
- package/dist/client/ps-daemon.d.ts +95 -0
- package/dist/client/ps-daemon.d.ts.map +1 -0
- package/dist/client/ps-daemon.js +424 -0
- package/dist/client/ps-daemon.js.map +1 -0
- package/dist/client/wps-client.d.ts +72 -0
- package/dist/client/wps-client.d.ts.map +1 -0
- package/dist/client/wps-client.js +408 -0
- package/dist/client/wps-client.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime-identity.d.ts +23 -0
- package/dist/runtime-identity.d.ts.map +1 -0
- package/dist/runtime-identity.js +26 -0
- package/dist/runtime-identity.js.map +1 -0
- package/dist/server/cancel-context.d.ts +30 -0
- package/dist/server/cancel-context.d.ts.map +1 -0
- package/dist/server/cancel-context.js +38 -0
- package/dist/server/cancel-context.js.map +1 -0
- package/dist/server/mcp-server.d.ts +74 -0
- package/dist/server/mcp-server.d.ts.map +1 -0
- package/dist/server/mcp-server.js +725 -0
- package/dist/server/mcp-server.js.map +1 -0
- package/dist/server/server-info.d.ts +21 -0
- package/dist/server/server-info.d.ts.map +1 -0
- package/dist/server/server-info.js +56 -0
- package/dist/server/server-info.js.map +1 -0
- package/dist/server/tool-annotations.d.ts +52 -0
- package/dist/server/tool-annotations.d.ts.map +1 -0
- package/dist/server/tool-annotations.generated.d.ts +14 -0
- package/dist/server/tool-annotations.generated.d.ts.map +1 -0
- package/dist/server/tool-annotations.generated.js +324 -0
- package/dist/server/tool-annotations.generated.js.map +1 -0
- package/dist/server/tool-annotations.js +116 -0
- package/dist/server/tool-annotations.js.map +1 -0
- package/dist/server/tool-group-events.d.ts +23 -0
- package/dist/server/tool-group-events.d.ts.map +1 -0
- package/dist/server/tool-group-events.js +44 -0
- package/dist/server/tool-group-events.js.map +1 -0
- package/dist/server/tool-metadata.d.ts +43 -0
- package/dist/server/tool-metadata.d.ts.map +1 -0
- package/dist/server/tool-metadata.js +657 -0
- package/dist/server/tool-metadata.js.map +1 -0
- package/dist/server/tool-registry.d.ts +164 -0
- package/dist/server/tool-registry.d.ts.map +1 -0
- package/dist/server/tool-registry.js +453 -0
- package/dist/server/tool-registry.js.map +1 -0
- package/dist/server/tool-tiers.d.ts +39 -0
- package/dist/server/tool-tiers.d.ts.map +1 -0
- package/dist/server/tool-tiers.js +102 -0
- package/dist/server/tool-tiers.js.map +1 -0
- package/dist/tools/common/batch.d.ts +33 -0
- package/dist/tools/common/batch.d.ts.map +1 -0
- package/dist/tools/common/batch.js +195 -0
- package/dist/tools/common/batch.js.map +1 -0
- package/dist/tools/common/convert.d.ts +41 -0
- package/dist/tools/common/convert.d.ts.map +1 -0
- package/dist/tools/common/convert.js +299 -0
- package/dist/tools/common/convert.js.map +1 -0
- package/dist/tools/common/general.d.ts +39 -0
- package/dist/tools/common/general.d.ts.map +1 -0
- package/dist/tools/common/general.js +624 -0
- package/dist/tools/common/general.js.map +1 -0
- package/dist/tools/common/index.d.ts +36 -0
- package/dist/tools/common/index.d.ts.map +1 -0
- package/dist/tools/common/index.js +102 -0
- package/dist/tools/common/index.js.map +1 -0
- package/dist/tools/common/intent.d.ts +48 -0
- package/dist/tools/common/intent.d.ts.map +1 -0
- package/dist/tools/common/intent.js +221 -0
- package/dist/tools/common/intent.js.map +1 -0
- package/dist/tools/common/repair.d.ts +29 -0
- package/dist/tools/common/repair.d.ts.map +1 -0
- package/dist/tools/common/repair.js +140 -0
- package/dist/tools/common/repair.js.map +1 -0
- package/dist/tools/common/status.d.ts +27 -0
- package/dist/tools/common/status.d.ts.map +1 -0
- package/dist/tools/common/status.js +139 -0
- package/dist/tools/common/status.js.map +1 -0
- package/dist/tools/common/toolgroups.d.ts +38 -0
- package/dist/tools/common/toolgroups.d.ts.map +1 -0
- package/dist/tools/common/toolgroups.js +238 -0
- package/dist/tools/common/toolgroups.js.map +1 -0
- package/dist/tools/excel/chart.d.ts +86 -0
- package/dist/tools/excel/chart.d.ts.map +1 -0
- package/dist/tools/excel/chart.js +659 -0
- package/dist/tools/excel/chart.js.map +1 -0
- package/dist/tools/excel/comment-protect.d.ts +58 -0
- package/dist/tools/excel/comment-protect.d.ts.map +1 -0
- package/dist/tools/excel/comment-protect.js +274 -0
- package/dist/tools/excel/comment-protect.js.map +1 -0
- package/dist/tools/excel/data-advanced.d.ts +47 -0
- package/dist/tools/excel/data-advanced.d.ts.map +1 -0
- package/dist/tools/excel/data-advanced.js +263 -0
- package/dist/tools/excel/data-advanced.js.map +1 -0
- package/dist/tools/excel/data.d.ts +91 -0
- package/dist/tools/excel/data.d.ts.map +1 -0
- package/dist/tools/excel/data.js +626 -0
- package/dist/tools/excel/data.js.map +1 -0
- package/dist/tools/excel/format.d.ts +42 -0
- package/dist/tools/excel/format.d.ts.map +1 -0
- package/dist/tools/excel/format.js +715 -0
- package/dist/tools/excel/format.js.map +1 -0
- package/dist/tools/excel/formula.d.ts +64 -0
- package/dist/tools/excel/formula.d.ts.map +1 -0
- package/dist/tools/excel/formula.js +333 -0
- package/dist/tools/excel/formula.js.map +1 -0
- package/dist/tools/excel/index.d.ts +44 -0
- package/dist/tools/excel/index.d.ts.map +1 -0
- package/dist/tools/excel/index.js +249 -0
- package/dist/tools/excel/index.js.map +1 -0
- package/dist/tools/excel/pivot.d.ts +39 -0
- package/dist/tools/excel/pivot.d.ts.map +1 -0
- package/dist/tools/excel/pivot.js +455 -0
- package/dist/tools/excel/pivot.js.map +1 -0
- package/dist/tools/excel/row-column.d.ts +64 -0
- package/dist/tools/excel/row-column.d.ts.map +1 -0
- package/dist/tools/excel/row-column.js +299 -0
- package/dist/tools/excel/row-column.js.map +1 -0
- package/dist/tools/excel/sheet-gaps.d.ts +50 -0
- package/dist/tools/excel/sheet-gaps.d.ts.map +1 -0
- package/dist/tools/excel/sheet-gaps.js +373 -0
- package/dist/tools/excel/sheet-gaps.js.map +1 -0
- package/dist/tools/excel/sheet.d.ts +112 -0
- package/dist/tools/excel/sheet.d.ts.map +1 -0
- package/dist/tools/excel/sheet.js +937 -0
- package/dist/tools/excel/sheet.js.map +1 -0
- package/dist/tools/excel/workbook.d.ts +62 -0
- package/dist/tools/excel/workbook.d.ts.map +1 -0
- package/dist/tools/excel/workbook.js +366 -0
- package/dist/tools/excel/workbook.js.map +1 -0
- package/dist/tools/index.d.ts +48 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +113 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/ppt/animation.d.ts +79 -0
- package/dist/tools/ppt/animation.d.ts.map +1 -0
- package/dist/tools/ppt/animation.js +719 -0
- package/dist/tools/ppt/animation.js.map +1 -0
- package/dist/tools/ppt/background.d.ts +72 -0
- package/dist/tools/ppt/background.d.ts.map +1 -0
- package/dist/tools/ppt/background.js +595 -0
- package/dist/tools/ppt/background.js.map +1 -0
- package/dist/tools/ppt/beautify-advanced.d.ts +72 -0
- package/dist/tools/ppt/beautify-advanced.d.ts.map +1 -0
- package/dist/tools/ppt/beautify-advanced.js +663 -0
- package/dist/tools/ppt/beautify-advanced.js.map +1 -0
- package/dist/tools/ppt/chart-flow.d.ts +58 -0
- package/dist/tools/ppt/chart-flow.d.ts.map +1 -0
- package/dist/tools/ppt/chart-flow.js +523 -0
- package/dist/tools/ppt/chart-flow.js.map +1 -0
- package/dist/tools/ppt/data-viz.d.ts +64 -0
- package/dist/tools/ppt/data-viz.d.ts.map +1 -0
- package/dist/tools/ppt/data-viz.js +514 -0
- package/dist/tools/ppt/data-viz.js.map +1 -0
- package/dist/tools/ppt/image.d.ts +30 -0
- package/dist/tools/ppt/image.d.ts.map +1 -0
- package/dist/tools/ppt/image.js +452 -0
- package/dist/tools/ppt/image.js.map +1 -0
- package/dist/tools/ppt/index.d.ts +72 -0
- package/dist/tools/ppt/index.d.ts.map +1 -0
- package/dist/tools/ppt/index.js +350 -0
- package/dist/tools/ppt/index.js.map +1 -0
- package/dist/tools/ppt/misc.d.ts +99 -0
- package/dist/tools/ppt/misc.d.ts.map +1 -0
- package/dist/tools/ppt/misc.js +868 -0
- package/dist/tools/ppt/misc.js.map +1 -0
- package/dist/tools/ppt/presentation.d.ts +72 -0
- package/dist/tools/ppt/presentation.d.ts.map +1 -0
- package/dist/tools/ppt/presentation.js +680 -0
- package/dist/tools/ppt/presentation.js.map +1 -0
- package/dist/tools/ppt/shape-basic.d.ts +46 -0
- package/dist/tools/ppt/shape-basic.d.ts.map +1 -0
- package/dist/tools/ppt/shape-basic.js +756 -0
- package/dist/tools/ppt/shape-basic.js.map +1 -0
- package/dist/tools/ppt/slide-ops.d.ts +79 -0
- package/dist/tools/ppt/slide-ops.d.ts.map +1 -0
- package/dist/tools/ppt/slide-ops.js +1646 -0
- package/dist/tools/ppt/slide-ops.js.map +1 -0
- package/dist/tools/ppt/slide.d.ts +51 -0
- package/dist/tools/ppt/slide.d.ts.map +1 -0
- package/dist/tools/ppt/slide.js +470 -0
- package/dist/tools/ppt/slide.js.map +1 -0
- package/dist/tools/ppt/table.d.ts +58 -0
- package/dist/tools/ppt/table.d.ts.map +1 -0
- package/dist/tools/ppt/table.js +512 -0
- package/dist/tools/ppt/table.js.map +1 -0
- package/dist/tools/ppt/textbox.d.ts +47 -0
- package/dist/tools/ppt/textbox.d.ts.map +1 -0
- package/dist/tools/ppt/textbox.js +246 -0
- package/dist/tools/ppt/textbox.js.map +1 -0
- package/dist/tools/word/academic.d.ts +50 -0
- package/dist/tools/word/academic.d.ts.map +1 -0
- package/dist/tools/word/academic.js +500 -0
- package/dist/tools/word/academic.js.map +1 -0
- package/dist/tools/word/content.d.ts +97 -0
- package/dist/tools/word/content.d.ts.map +1 -0
- package/dist/tools/word/content.js +838 -0
- package/dist/tools/word/content.js.map +1 -0
- package/dist/tools/word/document.d.ts +70 -0
- package/dist/tools/word/document.d.ts.map +1 -0
- package/dist/tools/word/document.js +633 -0
- package/dist/tools/word/document.js.map +1 -0
- package/dist/tools/word/format.d.ts +50 -0
- package/dist/tools/word/format.d.ts.map +1 -0
- package/dist/tools/word/format.js +462 -0
- package/dist/tools/word/format.js.map +1 -0
- package/dist/tools/word/gaps.d.ts +58 -0
- package/dist/tools/word/gaps.d.ts.map +1 -0
- package/dist/tools/word/gaps.js +431 -0
- package/dist/tools/word/gaps.js.map +1 -0
- package/dist/tools/word/index.d.ts +34 -0
- package/dist/tools/word/index.d.ts.map +1 -0
- package/dist/tools/word/index.js +124 -0
- package/dist/tools/word/index.js.map +1 -0
- package/dist/tools/word/professional.d.ts +48 -0
- package/dist/tools/word/professional.d.ts.map +1 -0
- package/dist/tools/word/professional.js +657 -0
- package/dist/tools/word/professional.js.map +1 -0
- package/dist/tools/word/proofread.d.ts +25 -0
- package/dist/tools/word/proofread.d.ts.map +1 -0
- package/dist/tools/word/proofread.js +718 -0
- package/dist/tools/word/proofread.js.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/tools.d.ts +163 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +45 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/types/wps.d.ts +190 -0
- package/dist/types/wps.d.ts.map +1 -0
- package/dist/types/wps.js +23 -0
- package/dist/types/wps.js.map +1 -0
- package/dist/utils/error.d.ts +147 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +417 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/logger.d.ts +56 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +138 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/version.d.ts +22 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +101 -0
- package/dist/version.js.map +1 -0
- package/package.json +57 -4
- package/scripts/wps-com.ps1 +7260 -0
- package/scripts/wps-comd.ps1 +123 -0
- package/skills/wps-multitool/SKILL.md +111 -0
- package/skills/wps-multitool/references/errors.md +62 -0
- package/skills/wps-multitool/references/recipes.md +82 -0
- package/skills/wps-multitool/references/routing.md +88 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beautify-advanced.d.ts","sourceRoot":"","sources":["../../../src/tools/ppt/beautify-advanced.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EACL,cAAc,EACd,WAAW,EAGX,cAAc,EACf,MAAM,mBAAmB,CAAC;AAI3B;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,cAiCxC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,WA0DrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,cA0BzC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,WA4DtC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,cA0BzC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,WAuDtC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,cAuCtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,WAqDnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,cA0CzC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,WA0DtC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,cA8B1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,WAsDvC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,cAyBxC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,WAoDrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,+BAA+B,EAAE,cA6B7C,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,WAiD1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,EASjD,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,663 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Input: PPT 高级美化操作参数
|
|
4
|
+
* Output: 高级美化操作结果
|
|
5
|
+
* Pos: PPT 高级美化工具实现。一旦我被修改,请更新我的头部注释,以及所属文件夹的md。
|
|
6
|
+
* PPT高级美化Tools - 高级美化模块
|
|
7
|
+
* 处理配色方案、自动美化、KPI卡片、装饰元素等高级美化操作
|
|
8
|
+
*
|
|
9
|
+
* 包含:
|
|
10
|
+
* - wps_ppt_apply_color_scheme: 应用配色方案
|
|
11
|
+
* - wps_ppt_auto_beautify_slide: 自动美化单页幻灯片
|
|
12
|
+
* - wps_ppt_beautify_all_slides: 批量美化所有幻灯片
|
|
13
|
+
* - wps_ppt_create_kpi_cards: 创建KPI指标卡片
|
|
14
|
+
* - wps_ppt_create_styled_table: 创建带样式的表格
|
|
15
|
+
* - wps_ppt_add_title_decoration: 添加标题装饰元素
|
|
16
|
+
* - wps_ppt_add_page_indicator: 添加页码指示器
|
|
17
|
+
* - wps_ppt_set_background_gradient: 设置渐变背景
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.beautifyAdvancedTools = exports.setBackgroundGradientHandler = exports.setBackgroundGradientDefinition = exports.addPageIndicatorHandler = exports.addPageIndicatorDefinition = exports.addTitleDecorationHandler = exports.addTitleDecorationDefinition = exports.createStyledTableHandler = exports.createStyledTableDefinition = exports.createKpiCardsHandler = exports.createKpiCardsDefinition = exports.beautifyAllSlidesHandler = exports.beautifyAllSlidesDefinition = exports.autoBeautifySlideHandler = exports.autoBeautifySlideDefinition = exports.applyColorSchemeHandler = exports.applyColorSchemeDefinition = void 0;
|
|
21
|
+
const uuid_1 = require("uuid");
|
|
22
|
+
const tools_1 = require("../../types/tools");
|
|
23
|
+
const wps_client_1 = require("../../client/wps-client");
|
|
24
|
+
const wps_1 = require("../../types/wps");
|
|
25
|
+
/**
|
|
26
|
+
* 应用配色方案
|
|
27
|
+
* 为幻灯片或全文档应用统一配色方案
|
|
28
|
+
*/
|
|
29
|
+
exports.applyColorSchemeDefinition = {
|
|
30
|
+
name: 'wps_ppt_apply_color_scheme',
|
|
31
|
+
description: `为幻灯片应用统一配色方案。
|
|
32
|
+
|
|
33
|
+
支持的配色方案:
|
|
34
|
+
- ocean: 海洋蓝(#0078D4主色)
|
|
35
|
+
- forest: 森林绿(#107C10主色)
|
|
36
|
+
- sunset: 日落橙(#FF8C00主色)
|
|
37
|
+
- lavender: 薰衣草紫(#7B68EE主色)
|
|
38
|
+
- corporate: 企业蓝灰(#2B579A主色)
|
|
39
|
+
- warm: 暖色调(#E74C3C主色)
|
|
40
|
+
- cool: 冷色调(#3498DB主色)
|
|
41
|
+
- monochrome: 单色黑白灰
|
|
42
|
+
|
|
43
|
+
使用场景:
|
|
44
|
+
- "给PPT换个海洋蓝配色"
|
|
45
|
+
- "用企业风格的配色方案"
|
|
46
|
+
- "统一所有页面的颜色"`,
|
|
47
|
+
category: tools_1.ToolCategory.PRESENTATION,
|
|
48
|
+
inputSchema: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
properties: {
|
|
51
|
+
slideIndex: {
|
|
52
|
+
type: 'number',
|
|
53
|
+
description: '幻灯片页码(从1开始),不填则应用到所有页',
|
|
54
|
+
},
|
|
55
|
+
scheme: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: '配色方案名称',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
required: ['scheme'],
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
const applyColorSchemeHandler = async (args) => {
|
|
64
|
+
const { slideIndex, scheme } = args;
|
|
65
|
+
try {
|
|
66
|
+
const response = await wps_client_1.wpsClient.executeMethod('applyColorScheme', { slideIndex, scheme }, wps_1.WpsAppType.PRESENTATION);
|
|
67
|
+
if (response.success && response.data) {
|
|
68
|
+
const schemeNames = {
|
|
69
|
+
ocean: '海洋蓝',
|
|
70
|
+
forest: '森林绿',
|
|
71
|
+
sunset: '日落橙',
|
|
72
|
+
lavender: '薰衣草紫',
|
|
73
|
+
corporate: '企业蓝灰',
|
|
74
|
+
warm: '暖色调',
|
|
75
|
+
cool: '冷色调',
|
|
76
|
+
monochrome: '单色黑白灰',
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
id: (0, uuid_1.v4)(),
|
|
80
|
+
success: true,
|
|
81
|
+
content: [
|
|
82
|
+
{
|
|
83
|
+
type: 'text',
|
|
84
|
+
text: `配色方案应用成功!\n方案: ${schemeNames[scheme] || scheme}\n范围: ${slideIndex ? `第 ${slideIndex} 页` : '所有幻灯片'}\n已应用页数: ${response.data.appliedSlides}`,
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return {
|
|
91
|
+
id: (0, uuid_1.v4)(),
|
|
92
|
+
success: false,
|
|
93
|
+
content: [{ type: 'text', text: `应用配色方案失败: ${response.error}` }],
|
|
94
|
+
error: response.error,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
100
|
+
return {
|
|
101
|
+
id: (0, uuid_1.v4)(),
|
|
102
|
+
success: false,
|
|
103
|
+
content: [{ type: 'text', text: `应用配色方案出错: ${errMsg}` }],
|
|
104
|
+
error: errMsg,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
exports.applyColorSchemeHandler = applyColorSchemeHandler;
|
|
109
|
+
/**
|
|
110
|
+
* 自动美化单页幻灯片
|
|
111
|
+
* 智能分析并优化单页幻灯片的排版、字体、间距和配色
|
|
112
|
+
*/
|
|
113
|
+
exports.autoBeautifySlideDefinition = {
|
|
114
|
+
name: 'wps_ppt_auto_beautify_slide',
|
|
115
|
+
description: `自动美化指定的单页幻灯片。
|
|
116
|
+
|
|
117
|
+
智能分析幻灯片内容并自动执行以下优化:
|
|
118
|
+
- 统一字体风格
|
|
119
|
+
- 优化元素间距和对齐
|
|
120
|
+
- 调整文本大小和行距
|
|
121
|
+
- 应用协调的配色
|
|
122
|
+
- 调整形状和图片布局
|
|
123
|
+
|
|
124
|
+
使用场景:
|
|
125
|
+
- "自动美化第3页"
|
|
126
|
+
- "优化这页PPT的排版"
|
|
127
|
+
- "一键美化当前幻灯片"`,
|
|
128
|
+
category: tools_1.ToolCategory.PRESENTATION,
|
|
129
|
+
inputSchema: {
|
|
130
|
+
type: 'object',
|
|
131
|
+
properties: {
|
|
132
|
+
slideIndex: {
|
|
133
|
+
type: 'number',
|
|
134
|
+
description: '幻灯片页码(从1开始)',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
required: ['slideIndex'],
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
const autoBeautifySlideHandler = async (args) => {
|
|
141
|
+
const { slideIndex } = args;
|
|
142
|
+
try {
|
|
143
|
+
const response = await wps_client_1.wpsClient.executeMethod('autoBeautifySlide', { slideIndex }, wps_1.WpsAppType.PRESENTATION);
|
|
144
|
+
if (response.success && response.data) {
|
|
145
|
+
let output = `幻灯片自动美化完成!\n幻灯片: 第 ${slideIndex} 页\n\n优化详情:\n`;
|
|
146
|
+
const opNames = {
|
|
147
|
+
unify_font: '统一字体',
|
|
148
|
+
optimize_spacing: '优化间距',
|
|
149
|
+
align_elements: '对齐元素',
|
|
150
|
+
adjust_colors: '调整配色',
|
|
151
|
+
fix_layout: '修正布局',
|
|
152
|
+
adjust_text_size: '调整文字大小',
|
|
153
|
+
};
|
|
154
|
+
response.data.operations.forEach((op) => {
|
|
155
|
+
output += `- ${opNames[op.operation] || op.operation}: 处理了 ${op.count} 个元素${op.details ? ` (${op.details})` : ''}\n`;
|
|
156
|
+
});
|
|
157
|
+
return {
|
|
158
|
+
id: (0, uuid_1.v4)(),
|
|
159
|
+
success: true,
|
|
160
|
+
content: [{ type: 'text', text: output }],
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return {
|
|
165
|
+
id: (0, uuid_1.v4)(),
|
|
166
|
+
success: false,
|
|
167
|
+
content: [{ type: 'text', text: `自动美化失败: ${response.error}` }],
|
|
168
|
+
error: response.error,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
174
|
+
return {
|
|
175
|
+
id: (0, uuid_1.v4)(),
|
|
176
|
+
success: false,
|
|
177
|
+
content: [{ type: 'text', text: `自动美化出错: ${errMsg}` }],
|
|
178
|
+
error: errMsg,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
exports.autoBeautifySlideHandler = autoBeautifySlideHandler;
|
|
183
|
+
/**
|
|
184
|
+
* 批量美化所有幻灯片
|
|
185
|
+
* 对演示文稿中所有幻灯片应用统一美化风格
|
|
186
|
+
*/
|
|
187
|
+
exports.beautifyAllSlidesDefinition = {
|
|
188
|
+
name: 'wps_ppt_beautify_all_slides',
|
|
189
|
+
description: `批量美化演示文稿中的所有幻灯片。
|
|
190
|
+
|
|
191
|
+
支持的风格:
|
|
192
|
+
- business: 商务风(稳重、专业)
|
|
193
|
+
- tech: 科技风(现代、简约)
|
|
194
|
+
- creative: 创意风(活泼、多彩)
|
|
195
|
+
- minimal: 极简风(留白、克制)
|
|
196
|
+
- academic: 学术风(严谨、规范)
|
|
197
|
+
|
|
198
|
+
使用场景:
|
|
199
|
+
- "把整个PPT都美化一下"
|
|
200
|
+
- "用科技风格统一美化所有页面"
|
|
201
|
+
- "一键优化整个演示文稿"`,
|
|
202
|
+
category: tools_1.ToolCategory.PRESENTATION,
|
|
203
|
+
inputSchema: {
|
|
204
|
+
type: 'object',
|
|
205
|
+
properties: {
|
|
206
|
+
style: {
|
|
207
|
+
type: 'string',
|
|
208
|
+
description: '美化风格,不填则默认使用 business 风格',
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
required: [],
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
const beautifyAllSlidesHandler = async (args) => {
|
|
215
|
+
const { style } = args;
|
|
216
|
+
try {
|
|
217
|
+
const response = await wps_client_1.wpsClient.executeMethod('beautifyAllSlides', { style: style || 'business' }, wps_1.WpsAppType.PRESENTATION);
|
|
218
|
+
if (response.success && response.data) {
|
|
219
|
+
const styleNames = {
|
|
220
|
+
business: '商务风',
|
|
221
|
+
tech: '科技风',
|
|
222
|
+
creative: '创意风',
|
|
223
|
+
minimal: '极简风',
|
|
224
|
+
academic: '学术风',
|
|
225
|
+
};
|
|
226
|
+
return {
|
|
227
|
+
id: (0, uuid_1.v4)(),
|
|
228
|
+
success: true,
|
|
229
|
+
content: [
|
|
230
|
+
{
|
|
231
|
+
type: 'text',
|
|
232
|
+
text: `全部幻灯片美化完成!\n风格: ${styleNames[response.data.style] || response.data.style}\n处理页数: ${response.data.slideCount} 页`,
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
return {
|
|
239
|
+
id: (0, uuid_1.v4)(),
|
|
240
|
+
success: false,
|
|
241
|
+
content: [{ type: 'text', text: `批量美化失败: ${response.error}` }],
|
|
242
|
+
error: response.error,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
248
|
+
return {
|
|
249
|
+
id: (0, uuid_1.v4)(),
|
|
250
|
+
success: false,
|
|
251
|
+
content: [{ type: 'text', text: `批量美化出错: ${errMsg}` }],
|
|
252
|
+
error: errMsg,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
exports.beautifyAllSlidesHandler = beautifyAllSlidesHandler;
|
|
257
|
+
/**
|
|
258
|
+
* 创建KPI指标卡片
|
|
259
|
+
* 在幻灯片上生成数据指标卡片,适合展示关键业绩数据
|
|
260
|
+
*/
|
|
261
|
+
exports.createKpiCardsDefinition = {
|
|
262
|
+
name: 'wps_ppt_create_kpi_cards',
|
|
263
|
+
description: `在幻灯片上创建KPI指标卡片。
|
|
264
|
+
|
|
265
|
+
每个KPI卡片数据项包含:
|
|
266
|
+
- title: 指标名称(如"销售额"、"增长率")
|
|
267
|
+
- value: 指标数值(如"¥128万"、"+15.3%")
|
|
268
|
+
- trend: 趋势方向(up/down/flat),可选
|
|
269
|
+
- color: 卡片颜色(十六进制),可选
|
|
270
|
+
|
|
271
|
+
使用场景:
|
|
272
|
+
- "创建一组KPI展示卡片"
|
|
273
|
+
- "在第2页展示销售数据指标"
|
|
274
|
+
- "添加业绩看板"`,
|
|
275
|
+
category: tools_1.ToolCategory.PRESENTATION,
|
|
276
|
+
inputSchema: {
|
|
277
|
+
type: 'object',
|
|
278
|
+
properties: {
|
|
279
|
+
slideIndex: {
|
|
280
|
+
type: 'number',
|
|
281
|
+
description: '幻灯片页码(从1开始)',
|
|
282
|
+
},
|
|
283
|
+
data: {
|
|
284
|
+
type: 'array',
|
|
285
|
+
description: 'KPI数据数组,每项包含title(指标名称)、value(指标数值)、trend(趋势:up/down/flat,可选)、color(颜色,可选)',
|
|
286
|
+
items: {
|
|
287
|
+
type: 'object',
|
|
288
|
+
properties: {
|
|
289
|
+
title: { type: 'string', description: '指标名称' },
|
|
290
|
+
value: { type: 'string', description: '指标数值' },
|
|
291
|
+
trend: { type: 'string', description: '趋势方向', enum: ['up', 'down', 'flat'] },
|
|
292
|
+
color: { type: 'string', description: '卡片颜色(十六进制)' },
|
|
293
|
+
},
|
|
294
|
+
required: ['title', 'value'],
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
required: ['slideIndex', 'data'],
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
const createKpiCardsHandler = async (args) => {
|
|
302
|
+
const { slideIndex, data } = args;
|
|
303
|
+
try {
|
|
304
|
+
const response = await wps_client_1.wpsClient.executeMethod('createKpiCards', { slideIndex, data }, wps_1.WpsAppType.PRESENTATION);
|
|
305
|
+
if (response.success && response.data) {
|
|
306
|
+
let output = `KPI卡片创建成功!\n幻灯片: 第 ${slideIndex} 页\n卡片数量: ${response.data.cardCount} 个\n\n指标列表:\n`;
|
|
307
|
+
data.forEach((item) => {
|
|
308
|
+
const trendIcon = item.trend === 'up' ? '↑' : item.trend === 'down' ? '↓' : '→';
|
|
309
|
+
output += `- ${item.title}: ${item.value} ${item.trend ? trendIcon : ''}\n`;
|
|
310
|
+
});
|
|
311
|
+
return {
|
|
312
|
+
id: (0, uuid_1.v4)(),
|
|
313
|
+
success: true,
|
|
314
|
+
content: [{ type: 'text', text: output }],
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
return {
|
|
319
|
+
id: (0, uuid_1.v4)(),
|
|
320
|
+
success: false,
|
|
321
|
+
content: [{ type: 'text', text: `创建KPI卡片失败: ${response.error}` }],
|
|
322
|
+
error: response.error,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
catch (error) {
|
|
327
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
328
|
+
return {
|
|
329
|
+
id: (0, uuid_1.v4)(),
|
|
330
|
+
success: false,
|
|
331
|
+
content: [{ type: 'text', text: `创建KPI卡片出错: ${errMsg}` }],
|
|
332
|
+
error: errMsg,
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
exports.createKpiCardsHandler = createKpiCardsHandler;
|
|
337
|
+
/**
|
|
338
|
+
* 创建带样式的表格
|
|
339
|
+
* 插入预设样式的精美表格
|
|
340
|
+
*/
|
|
341
|
+
exports.createStyledTableDefinition = {
|
|
342
|
+
name: 'wps_ppt_create_styled_table',
|
|
343
|
+
description: `在幻灯片中创建带预设样式的精美表格。
|
|
344
|
+
|
|
345
|
+
表格数据格式:二维数组,第一行为表头。
|
|
346
|
+
例如: [["姓名","分数"],["张三","95"],["李四","88"]]
|
|
347
|
+
|
|
348
|
+
支持的样式:
|
|
349
|
+
- blue: 蓝色主题(默认)
|
|
350
|
+
- green: 绿色主题
|
|
351
|
+
- orange: 橙色主题
|
|
352
|
+
- gray: 灰色主题
|
|
353
|
+
- dark: 深色主题
|
|
354
|
+
- striped: 斑马纹样式
|
|
355
|
+
|
|
356
|
+
使用场景:
|
|
357
|
+
- "创建一个蓝色主题的数据表格"
|
|
358
|
+
- "插入带样式的表格"
|
|
359
|
+
- "在第3页添加成绩表"`,
|
|
360
|
+
category: tools_1.ToolCategory.PRESENTATION,
|
|
361
|
+
inputSchema: {
|
|
362
|
+
type: 'object',
|
|
363
|
+
properties: {
|
|
364
|
+
slideIndex: {
|
|
365
|
+
type: 'number',
|
|
366
|
+
description: '幻灯片页码(从1开始)',
|
|
367
|
+
},
|
|
368
|
+
data: {
|
|
369
|
+
type: 'array',
|
|
370
|
+
description: '表格数据,二维数组格式,第一行为表头',
|
|
371
|
+
items: {
|
|
372
|
+
type: 'array',
|
|
373
|
+
items: { type: 'string' },
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
style: {
|
|
377
|
+
type: 'string',
|
|
378
|
+
description: '表格样式,不填默认使用 blue',
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
required: ['slideIndex', 'data'],
|
|
382
|
+
},
|
|
383
|
+
};
|
|
384
|
+
const createStyledTableHandler = async (args) => {
|
|
385
|
+
const { slideIndex, data, style } = args;
|
|
386
|
+
try {
|
|
387
|
+
const response = await wps_client_1.wpsClient.executeMethod('createStyledTable', { slideIndex, data, style: style || 'blue' }, wps_1.WpsAppType.PRESENTATION);
|
|
388
|
+
if (response.success && response.data) {
|
|
389
|
+
const styleNames = {
|
|
390
|
+
blue: '蓝色主题',
|
|
391
|
+
green: '绿色主题',
|
|
392
|
+
orange: '橙色主题',
|
|
393
|
+
gray: '灰色主题',
|
|
394
|
+
dark: '深色主题',
|
|
395
|
+
striped: '斑马纹',
|
|
396
|
+
};
|
|
397
|
+
return {
|
|
398
|
+
id: (0, uuid_1.v4)(),
|
|
399
|
+
success: true,
|
|
400
|
+
content: [
|
|
401
|
+
{
|
|
402
|
+
type: 'text',
|
|
403
|
+
text: `带样式表格创建成功!\n幻灯片: 第 ${slideIndex} 页\n规格: ${response.data.rows} 行 × ${response.data.cols} 列\n样式: ${styleNames[style || 'blue'] || style}`,
|
|
404
|
+
},
|
|
405
|
+
],
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
return {
|
|
410
|
+
id: (0, uuid_1.v4)(),
|
|
411
|
+
success: false,
|
|
412
|
+
content: [{ type: 'text', text: `创建带样式表格失败: ${response.error}` }],
|
|
413
|
+
error: response.error,
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
catch (error) {
|
|
418
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
419
|
+
return {
|
|
420
|
+
id: (0, uuid_1.v4)(),
|
|
421
|
+
success: false,
|
|
422
|
+
content: [{ type: 'text', text: `创建带样式表格出错: ${errMsg}` }],
|
|
423
|
+
error: errMsg,
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
exports.createStyledTableHandler = createStyledTableHandler;
|
|
428
|
+
/**
|
|
429
|
+
* 添加标题装饰元素
|
|
430
|
+
* 为幻灯片标题添加装饰性元素(下划线、色块、图标等)
|
|
431
|
+
*/
|
|
432
|
+
exports.addTitleDecorationDefinition = {
|
|
433
|
+
name: 'wps_ppt_add_title_decoration',
|
|
434
|
+
description: `为幻灯片标题添加装饰性元素。
|
|
435
|
+
|
|
436
|
+
支持的装饰样式:
|
|
437
|
+
- underline: 标题下划线装饰
|
|
438
|
+
- block: 色块背景装饰
|
|
439
|
+
- sidebar: 侧边竖条装饰
|
|
440
|
+
- bracket: 括号框装饰
|
|
441
|
+
- gradient_bar: 渐变条装饰
|
|
442
|
+
|
|
443
|
+
使用场景:
|
|
444
|
+
- "给标题加个装饰线"
|
|
445
|
+
- "美化标题样式"
|
|
446
|
+
- "添加侧边装饰条"`,
|
|
447
|
+
category: tools_1.ToolCategory.PRESENTATION,
|
|
448
|
+
inputSchema: {
|
|
449
|
+
type: 'object',
|
|
450
|
+
properties: {
|
|
451
|
+
slideIndex: {
|
|
452
|
+
type: 'number',
|
|
453
|
+
description: '幻灯片页码(从1开始)',
|
|
454
|
+
},
|
|
455
|
+
style: {
|
|
456
|
+
type: 'string',
|
|
457
|
+
description: '装饰样式,不填默认使用 underline',
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
required: ['slideIndex'],
|
|
461
|
+
},
|
|
462
|
+
};
|
|
463
|
+
const addTitleDecorationHandler = async (args) => {
|
|
464
|
+
const { slideIndex, style } = args;
|
|
465
|
+
try {
|
|
466
|
+
const response = await wps_client_1.wpsClient.executeMethod('addTitleDecoration', { slideIndex, style: style || 'underline' }, wps_1.WpsAppType.PRESENTATION);
|
|
467
|
+
if (response.success) {
|
|
468
|
+
const styleNames = {
|
|
469
|
+
underline: '下划线装饰',
|
|
470
|
+
block: '色块背景装饰',
|
|
471
|
+
sidebar: '侧边竖条装饰',
|
|
472
|
+
bracket: '括号框装饰',
|
|
473
|
+
gradient_bar: '渐变条装饰',
|
|
474
|
+
};
|
|
475
|
+
return {
|
|
476
|
+
id: (0, uuid_1.v4)(),
|
|
477
|
+
success: true,
|
|
478
|
+
content: [
|
|
479
|
+
{
|
|
480
|
+
type: 'text',
|
|
481
|
+
text: `标题装饰添加成功!\n幻灯片: 第 ${slideIndex} 页\n装饰样式: ${styleNames[style || 'underline'] || style}`,
|
|
482
|
+
},
|
|
483
|
+
],
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
return {
|
|
488
|
+
id: (0, uuid_1.v4)(),
|
|
489
|
+
success: false,
|
|
490
|
+
content: [{ type: 'text', text: `添加标题装饰失败: ${response.error}` }],
|
|
491
|
+
error: response.error,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
catch (error) {
|
|
496
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
497
|
+
return {
|
|
498
|
+
id: (0, uuid_1.v4)(),
|
|
499
|
+
success: false,
|
|
500
|
+
content: [{ type: 'text', text: `添加标题装饰出错: ${errMsg}` }],
|
|
501
|
+
error: errMsg,
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
exports.addTitleDecorationHandler = addTitleDecorationHandler;
|
|
506
|
+
/**
|
|
507
|
+
* 添加页码指示器
|
|
508
|
+
* 在幻灯片上添加页码/进度指示器
|
|
509
|
+
*/
|
|
510
|
+
exports.addPageIndicatorDefinition = {
|
|
511
|
+
name: 'wps_ppt_add_page_indicator',
|
|
512
|
+
description: `为演示文稿添加页码指示器。
|
|
513
|
+
|
|
514
|
+
支持的位置:
|
|
515
|
+
- bottom-right: 右下角(默认)
|
|
516
|
+
- bottom-center: 底部居中
|
|
517
|
+
- bottom-left: 左下角
|
|
518
|
+
|
|
519
|
+
使用场景:
|
|
520
|
+
- "给PPT加上页码"
|
|
521
|
+
- "在右下角添加页码指示"
|
|
522
|
+
- "添加页面进度指示器"`,
|
|
523
|
+
category: tools_1.ToolCategory.PRESENTATION,
|
|
524
|
+
inputSchema: {
|
|
525
|
+
type: 'object',
|
|
526
|
+
properties: {
|
|
527
|
+
position: {
|
|
528
|
+
type: 'string',
|
|
529
|
+
description: '页码位置',
|
|
530
|
+
enum: ['bottom-right', 'bottom-center', 'bottom-left'],
|
|
531
|
+
},
|
|
532
|
+
},
|
|
533
|
+
required: [],
|
|
534
|
+
},
|
|
535
|
+
};
|
|
536
|
+
const addPageIndicatorHandler = async (args) => {
|
|
537
|
+
const { position } = args;
|
|
538
|
+
try {
|
|
539
|
+
const response = await wps_client_1.wpsClient.executeMethod('addPageIndicator', { position: position || 'bottom-right' }, wps_1.WpsAppType.PRESENTATION);
|
|
540
|
+
if (response.success && response.data) {
|
|
541
|
+
const posNames = {
|
|
542
|
+
'bottom-right': '右下角',
|
|
543
|
+
'bottom-center': '底部居中',
|
|
544
|
+
'bottom-left': '左下角',
|
|
545
|
+
};
|
|
546
|
+
return {
|
|
547
|
+
id: (0, uuid_1.v4)(),
|
|
548
|
+
success: true,
|
|
549
|
+
content: [
|
|
550
|
+
{
|
|
551
|
+
type: 'text',
|
|
552
|
+
text: `页码指示器添加成功!\n位置: ${posNames[position || 'bottom-right'] || position}\n已添加页数: ${response.data.slideCount} 页`,
|
|
553
|
+
},
|
|
554
|
+
],
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
return {
|
|
559
|
+
id: (0, uuid_1.v4)(),
|
|
560
|
+
success: false,
|
|
561
|
+
content: [{ type: 'text', text: `添加页码指示器失败: ${response.error}` }],
|
|
562
|
+
error: response.error,
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
catch (error) {
|
|
567
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
568
|
+
return {
|
|
569
|
+
id: (0, uuid_1.v4)(),
|
|
570
|
+
success: false,
|
|
571
|
+
content: [{ type: 'text', text: `添加页码指示器出错: ${errMsg}` }],
|
|
572
|
+
error: errMsg,
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
exports.addPageIndicatorHandler = addPageIndicatorHandler;
|
|
577
|
+
/**
|
|
578
|
+
* 设置渐变背景
|
|
579
|
+
* 为幻灯片设置渐变色背景
|
|
580
|
+
*/
|
|
581
|
+
exports.setBackgroundGradientDefinition = {
|
|
582
|
+
name: 'wps_ppt_set_background_gradient',
|
|
583
|
+
description: `为幻灯片设置渐变色背景。
|
|
584
|
+
|
|
585
|
+
渐变配置对象(gradient)属性:
|
|
586
|
+
- type: 渐变类型(linear/radial),默认linear
|
|
587
|
+
- angle: 渐变角度(0-360度),仅linear有效,默认180
|
|
588
|
+
- colors: 渐变颜色数组(如 ["#1a1a2e", "#16213e", "#0f3460"])
|
|
589
|
+
- stops: 颜色停靠点数组(如 [0, 0.5, 1]),与colors对应
|
|
590
|
+
|
|
591
|
+
使用场景:
|
|
592
|
+
- "设置蓝色渐变背景"
|
|
593
|
+
- "给第2页加个从深到浅的渐变"
|
|
594
|
+
- "设置PPT背景为渐变色"`,
|
|
595
|
+
category: tools_1.ToolCategory.PRESENTATION,
|
|
596
|
+
inputSchema: {
|
|
597
|
+
type: 'object',
|
|
598
|
+
properties: {
|
|
599
|
+
slideIndex: {
|
|
600
|
+
type: 'number',
|
|
601
|
+
description: '幻灯片页码(从1开始)',
|
|
602
|
+
},
|
|
603
|
+
gradient: {
|
|
604
|
+
type: 'object',
|
|
605
|
+
description: '渐变配置对象,包含type(linear/radial)、angle(角度)、colors(颜色数组)、stops(停靠点数组)',
|
|
606
|
+
},
|
|
607
|
+
},
|
|
608
|
+
required: ['slideIndex', 'gradient'],
|
|
609
|
+
},
|
|
610
|
+
};
|
|
611
|
+
const setBackgroundGradientHandler = async (args) => {
|
|
612
|
+
const { slideIndex, gradient } = args;
|
|
613
|
+
try {
|
|
614
|
+
const response = await wps_client_1.wpsClient.executeMethod('setBackgroundGradient', { slideIndex, gradient }, wps_1.WpsAppType.PRESENTATION);
|
|
615
|
+
if (response.success) {
|
|
616
|
+
const gradientType = gradient.type === 'radial' ? '径向渐变' : '线性渐变';
|
|
617
|
+
const colors = Array.isArray(gradient.colors) ? gradient.colors.join(' → ') : '';
|
|
618
|
+
return {
|
|
619
|
+
id: (0, uuid_1.v4)(),
|
|
620
|
+
success: true,
|
|
621
|
+
content: [
|
|
622
|
+
{
|
|
623
|
+
type: 'text',
|
|
624
|
+
text: `渐变背景设置成功!\n幻灯片: 第 ${slideIndex} 页\n渐变类型: ${gradientType}${gradient.angle ? `\n渐变角度: ${gradient.angle}°` : ''}${colors ? `\n颜色: ${colors}` : ''}`,
|
|
625
|
+
},
|
|
626
|
+
],
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
else {
|
|
630
|
+
return {
|
|
631
|
+
id: (0, uuid_1.v4)(),
|
|
632
|
+
success: false,
|
|
633
|
+
content: [{ type: 'text', text: `设置渐变背景失败: ${response.error}` }],
|
|
634
|
+
error: response.error,
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
catch (error) {
|
|
639
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
640
|
+
return {
|
|
641
|
+
id: (0, uuid_1.v4)(),
|
|
642
|
+
success: false,
|
|
643
|
+
content: [{ type: 'text', text: `设置渐变背景出错: ${errMsg}` }],
|
|
644
|
+
error: errMsg,
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
exports.setBackgroundGradientHandler = setBackgroundGradientHandler;
|
|
649
|
+
/**
|
|
650
|
+
* 导出所有高级美化相关的Tools
|
|
651
|
+
*/
|
|
652
|
+
exports.beautifyAdvancedTools = [
|
|
653
|
+
{ definition: exports.applyColorSchemeDefinition, handler: exports.applyColorSchemeHandler },
|
|
654
|
+
{ definition: exports.autoBeautifySlideDefinition, handler: exports.autoBeautifySlideHandler },
|
|
655
|
+
{ definition: exports.beautifyAllSlidesDefinition, handler: exports.beautifyAllSlidesHandler },
|
|
656
|
+
{ definition: exports.createKpiCardsDefinition, handler: exports.createKpiCardsHandler },
|
|
657
|
+
{ definition: exports.createStyledTableDefinition, handler: exports.createStyledTableHandler },
|
|
658
|
+
{ definition: exports.addTitleDecorationDefinition, handler: exports.addTitleDecorationHandler },
|
|
659
|
+
{ definition: exports.addPageIndicatorDefinition, handler: exports.addPageIndicatorHandler },
|
|
660
|
+
{ definition: exports.setBackgroundGradientDefinition, handler: exports.setBackgroundGradientHandler },
|
|
661
|
+
];
|
|
662
|
+
exports.default = exports.beautifyAdvancedTools;
|
|
663
|
+
//# sourceMappingURL=beautify-advanced.js.map
|