dsh-ppt 0.29.0 → 0.30.0

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.
@@ -1,12 +1,16 @@
1
1
  # 标杆范本库与槽位填空契约(Curated Exemplar Corpus & Weak-LLM Compensator)
2
2
 
3
3
  本参考面向两类高频需求:
4
- 1. **将自由规划降维为「槽位填空(Slot-Filling)」**:直接按内置 **8 套满分标杆范本**(或工作区批量吸收的优质 `.pptx` 范本)逐页填空,让任意能力层级的模型稳定产出麦肯锡 / 红杉 / Stripe / Nature 级排版。
4
+ 1. **将自由规划降维为「槽位填空(Slot-Filling)」**:直接按内置 **20 套满分标杆范本**(或工作区批量吸收的优质 `.pptx` 范本)逐页填空,让任意能力层级的模型稳定产出麦肯锡 / 红杉 / Stripe / 投行研报 / 临床医学级排版。
5
5
  2. **向工作区投喂外部优质 PPT 语料**:把本地或开源社区收集的高颜值 `.pptx` 目录批量吸收为持久化范本库(`.dsh-ppt/exemplars.json` + `.dsh-ppt/taste-recipes.json`),零额外运行时依赖、100% 离线提取且自动过滤隐藏说明页。
6
6
 
7
7
  ---
8
8
 
9
- ## 1. 内置 8 套标杆范本速查表
9
+ ## 1. 内置 20 套标杆范本速查表(8 套核心场景 + 12 套 GitHub 开源优质 `.pptx` 蒸馏)
10
+
11
+ > 支持传入 `exemplar: "auto"` 自动根据标题与正文字面语义路由到最佳标杆范本;调 `ppt_templates({ exemplarId })` 同步返回逐页槽位契约、满分标题示范与 **Few-Shot JSON 填空样板**。
12
+
13
+ ### A. 8 套核心场景标杆
10
14
 
11
15
  | Exemplar ID | 场景名称 | 继承主题 | 继承品味配方 | 骨架 | 页数与版式节奏 |
12
16
  | --- | --- | --- | --- | --- | --- |
@@ -19,6 +23,23 @@
19
23
  | `enterprise-proposal` | 政企大客户解决方案与竞标提案 | `bcg-emerald` | `mckinsey-partner` | `consulting-classic` | 9 页:architectural 封面 → 价值摘要 → 痛点对策 → 私有化部署架构 → 哈维球盲测 → ROI 指标 → 12 周甘特 → SLA 团队 → POC 行动卡 |
20
24
  | `gov-institutional` | 现代东方政务述职与年度工作报告 | `exec-jilan` | `oriental-zen` | `gov-ceremonial` | 8 页:inverted 封面 → spotlight KPI → 重点成果卡片 → 区域热力图 → 阶段推进时间轴 → 问题与整改 → 下阶段部署甘特 → 结语 |
21
25
 
26
+ ### B. 12 套 GitHub 开源优质 `.pptx` 实机甄选蒸馏标杆(Apache-2.0 / MIT / CC-BY-4.0)
27
+
28
+ | Exemplar ID | 场景名称 | 视觉 DNA(实测提取) | 开源溯源 | 协议 |
29
+ | --- | --- | --- | --- | --- |
30
+ | `mckinsey-evolution` | 麦肯锡阶梯演进与宏观趋势诊断 | `#FFFFFF` 底 + `#062337` 深墨蓝 + `#C0504D` 批注红 · `editorial-rule` | `likaku/Mck-ppt-design-skill` | Apache-2.0 |
31
+ | `luxury-budget-review` | 黑金高管财务预算与资金复盘 | `#080A0E` 曜石黑 + `#C9A84C` 香槟金 + `#5A9E48` 翡翠绿 · `glass` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
32
+ | `swiss-bauhaus-workshop` | 瑞士包豪斯设计评审与创新工作坊 | `#E63322` 包豪斯红 + `#E6B319` 明黄 · `editorial-folio` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
33
+ | `dark-stage-investor` | 暗夜舞台 Demo Day 高张力融资路演 | `#0A0A12` 深空蓝黑 + `#E94560` 珊瑚红 + `#3B82F6` 电光蓝 · `glass` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
34
+ | `blueprint-ai-factory` | 工程蓝图网格 AI 基础设施与智能体平台 | `#090E13` 工程深蓝 + `#4A90D9` 蓝图青 + `#E97E35` 警示橙 · `grid` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
35
+ | `warm-brand-story` | 暖宣纸撞色品牌焕新与市场增长提案 | `#F6F2EA` 暖宣纸 + `#101B3B` 藏青 + `#EC7442` 珊瑚橘 · `editorial-rule` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
36
+ | `ted-storytelling-keynote` | 暗夜极简主题演讲与观点叙事 | `#090C13` 剧场黑 + `#2BE4A8` 薄荷青 + `#E9A936` 琥珀金 · `glass` | `iOfficeAI/OfficeCLI` | Apache-2.0 |
37
+ | `msft-enterprise-discovery` | 微软企业级 AI 场景发现与价值评估工作坊 | `#FFFFFF` 白底 + `#1376C0` Azure 蓝 + `#0E7490` · 哈维球 + 四象限 | `microsoft/dstoolkit-DiscoveryEnvisioning` | MIT |
38
+ | `daylight-earnings-research` | 浅色投行研报与上市公司财报 | `#FAF9F6` 暖米纸 + `#1D6E6B` 机构深青 + `#9B4E23` 铜褐 · `editorial-rule` | `hustcer/pptx-nova` (`clear-value`) | Apache-2.0 |
39
+ | `okr-performance-review` | 中文大厂述职与 OKR 季度复盘 | `#FFFFFF` 极净白 + `#1277BA` 航标蓝 + `#137B43` 达标绿 · 目标实际表 | `hustcer/pptx-nova` (`sky-compass`) | Apache-2.0 |
40
+ | `quiet-canvas-keynote` | 极简静谧画布与浅色设计发布会 | `#EBE8E2` 暖宣麻 + `#AA6E53` 陶土红 + `#587F8A` 灰石蓝 · 54% 高留白 | `hustcer/pptx-nova` (`D1-Quiet-Canvas`) | Apache-2.0 |
41
+ | `medical-clinical-course` | 医学临床汇报与循证科研课件 | `#F1F0EC` 暖临床石 + `#0B6A48` 医学深绿 + `#EA613E` 珊瑚标 · 队列三线表 | `grotyx/medical-ppt-design` & `hustcer/pptx-nova` | CC-BY-4.0 / Apache-2.0 |
42
+
22
43
  ---
23
44
 
24
45
  ## 2. 弱/中等模型标准两步出稿法(推荐)
@@ -540,10 +540,10 @@ function analyzeSlideLayout(lib, slide, slideIndex, totalSlides, slideW, slideH)
540
540
  let largeCardShapes = 0
541
541
  let numericKpiShapes = 0
542
542
  let harveyCells = tableMeta.hasHarvey
543
- let harveyPieOrCircles = 0
543
+ const harveyDotCoords = []
544
544
  let waterfallBars = 0
545
545
  let chevronShapes = 0
546
- let ellipseCircles = 0
546
+ const ellipseCircles = []
547
547
  let diamondShapes = 0
548
548
  let connectorShapes = 0
549
549
  let horizontalAxisLines = 0
@@ -579,8 +579,12 @@ function analyzeSlideLayout(lib, slide, slideIndex, totalSlides, slideW, slideH)
579
579
  if (name.startsWith('harvey ')) {
580
580
  harveyCells = true
581
581
  } else if (bounds && (preset === 'pie' || preset === 'ellipse') && (bounds.w / slideW) >= 0.01 && (bounds.w / slideW) <= 0.045 && Math.abs(bounds.w - bounds.h) <= bounds.w * 0.18) {
582
- harveyPieOrCircles += 1
583
- if (harveyPieOrCircles >= 4) harveyCells = true
582
+ const rx = bounds.x / slideW
583
+ const ry = bounds.y / slideH
584
+ // Ignore decorative vertical dot margins (left/right edges) — Harvey matrices sit inside the body grid
585
+ if (rx >= 0.18 && rx <= 0.92 && ry >= 0.20 && ry <= 0.88) {
586
+ harveyDotCoords.push({ x: rx, y: ry })
587
+ }
584
588
  }
585
589
  if (kind === 'connector' || preset.includes('connector') || preset === 'line') {
586
590
  const inBodyZone = bounds && (bounds.y / slideH) > 0.22 && (bounds.y / slideH) < 0.86 && !/rule|folio|divider|header|footer|takeaway/i.test(name)
@@ -647,7 +651,7 @@ function analyzeSlideLayout(lib, slide, slideIndex, totalSlides, slideW, slideH)
647
651
  if (preset === 'chevron' || preset === 'homeplate' || preset === 'pentagon') {
648
652
  chevronShapes += 1
649
653
  } else if (preset === 'ellipse' && relW >= 0.12 && relH >= 0.16 && Math.abs(bounds.w - bounds.h) <= Math.max(bounds.w, bounds.h) * 0.45) {
650
- ellipseCircles += 1
654
+ ellipseCircles.push({ cx: relX + relW / 2, cy: relY + relH / 2, r: (relW + relH) / 4 })
651
655
  } else if (preset === 'diamond' && relW <= 0.08 && relH <= 0.12) {
652
656
  diamondShapes += 1
653
657
  }
@@ -697,6 +701,14 @@ function analyzeSlideLayout(lib, slide, slideIndex, totalSlides, slideW, slideH)
697
701
  const hasTopSummaryBanner = cardRects.some((r) => r.w >= 0.68 && r.h <= 0.26 && r.y <= 0.38)
698
702
  const lowerPillars = cardRects.filter((r) => r.w <= 0.42 && r.y >= 0.34)
699
703
 
704
+ if (!harveyCells && harveyDotCoords.length >= 4) {
705
+ const distinctCols = new Set(harveyDotCoords.map((p) => Math.round(p.x * 16))).size
706
+ const distinctRows = new Set(harveyDotCoords.map((p) => Math.round(p.y * 12))).size
707
+ if (distinctCols >= 2 && distinctRows >= 2) harveyCells = true
708
+ }
709
+ const hasConcentricCircles = ellipseCircles.length >= 2 && ellipseCircles.some((a, ai) =>
710
+ ellipseCircles.some((b, bi) => bi > ai && Math.hypot(a.cx - b.cx, a.cy - b.cy) <= 0.16 && Math.abs(a.r - b.r) >= 0.04))
711
+
700
712
  // Priority order: rich native charts/tables/diagrams -> media -> framing -> structured layouts
701
713
  if (waterfallBars >= 3 || isWaterfallChart) {
702
714
  result.inferredLayout = 'waterfall'
@@ -707,7 +719,7 @@ function analyzeSlideLayout(lib, slide, slideIndex, totalSlides, slideW, slideH)
707
719
  } else if (hasTable) {
708
720
  result.inferredLayout = 'table'
709
721
  if (tableMeta.styleHint) result.tableStyle = tableMeta.styleHint
710
- } else if (ellipseCircles >= 2 && (ellipseCircles >= 3 || tamTextHits >= 2 || /市场规模|市场空间|\bTAM\b/i.test(combinedSignal))) {
722
+ } else if (ellipseCircles.length >= 2 && (tamTextHits >= 2 || /市场规模|市场空间|\bTAM\b|\bSAM\b|\bSOM\b/i.test(combinedSignal) || (ellipseCircles.length >= 3 && hasConcentricCircles))) {
711
723
  result.inferredLayout = 'tam'
712
724
  result.variant = 'concentric'
713
725
  } else if (chevronShapes >= 3) {
@@ -1225,9 +1237,11 @@ export async function absorbPptx(options = {}) {
1225
1237
  }
1226
1238
 
1227
1239
  let coreTitle = ''
1240
+ const isGenericDeckTitle = (t) =>
1241
+ /^(?:PowerPoint\s*(?:Presentation|演示文稿)|Microsoft\s+PowerPoint(?:\s+Presentation)?|Presentation\s*\d*|Slide\s*Deck|Untitled(?:\s+Presentation)?|Default\s+Presentation|演示文稿\s*\d*|幻灯片\s*\d*|新建\s*Microsoft\s*PowerPoint\s*演示文稿|WPS\s*演示)$/i.test(t)
1228
1242
  try {
1229
1243
  const props = lib.getCoreProperties(pres)
1230
- if (typeof props?.title === 'string' && props.title.trim() && !/^PowerPoint 演示文稿$|^Presentation\d*$/i.test(props.title.trim())) {
1244
+ if (typeof props?.title === 'string' && props.title.trim() && !isGenericDeckTitle(props.title.trim())) {
1231
1245
  coreTitle = props.title.trim().slice(0, 100)
1232
1246
  }
1233
1247
  } catch { /* ignore */ }
@@ -1238,7 +1252,7 @@ export async function absorbPptx(options = {}) {
1238
1252
  ...(logoDataUri ? { logo: logoDataUri } : {}),
1239
1253
  }
1240
1254
  const isOfficeDefaultFont = (f) =>
1241
- /^(?:SimSun|NSimSun|宋体|新宋体|FangSong|仿宋|Impact|Comic Sans MS)$/i.test(f) ||
1255
+ /^(?:SimSun|NSimSun|宋体|新宋体|FangSong|仿宋|Impact|Comic Sans MS|Songti SC|PingFang SC|Hiragino Sans GB|STSong|STHeiti|STFangsong|STKaiti|Arial Unicode MS|Apple SD Gothic Neo|Pretendard|Menlo|SF Pro(?: Display| Text)?|Helvetica Neue|Playfair Display)$/i.test(f) ||
1242
1256
  (/^(?:Calibri|Calibri Light|Aptos|Aptos Display)$/i.test(f) &&
1243
1257
  !extractedFonts.majorEastAsian &&
1244
1258
  !extractedFonts.minorEastAsian)
@@ -26,6 +26,8 @@ import {
26
26
  import {
27
27
  CURATED_EXEMPLARS,
28
28
  CURATED_EXEMPLAR_IDS,
29
+ GITHUB_DISTILLED_EXEMPLARS,
30
+ getExemplarFewShotSlides,
29
31
  listCuratedExemplars,
30
32
  resolveExemplar,
31
33
  loadWorkspaceExemplars,
@@ -49,6 +51,8 @@ export { listAllTasteRecipes, listCuratedTasteRecipes, loadWorkspaceTasteRecipes
49
51
  export {
50
52
  CURATED_EXEMPLARS,
51
53
  CURATED_EXEMPLAR_IDS,
54
+ GITHUB_DISTILLED_EXEMPLARS,
55
+ getExemplarFewShotSlides,
52
56
  listCuratedExemplars,
53
57
  resolveExemplar,
54
58
  loadWorkspaceExemplars,
@@ -672,9 +676,17 @@ export async function buildDeckAsync(options = {}) {
672
676
  }
673
677
 
674
678
  const workspaceExemplars = loadWorkspaceExemplars(cwd)
675
- const resolvedExemplar = options.exemplar !== undefined && options.exemplar !== null && options.exemplar !== ''
676
- ? resolveExemplar(options.exemplar, workspaceExemplars)
677
- : null
679
+ const rawExemplarStr = typeof options.exemplar === 'string' ? options.exemplar.trim() : ''
680
+ const resolvedExemplar = rawExemplarStr.toLowerCase() === 'auto'
681
+ ? matchBestExemplar({
682
+ title: options.title,
683
+ content: options.content || (Array.isArray(options.slides) ? options.slides.map((s) => `${s?.title || ''} ${(s?.bullets || []).join(' ')}`).join(' ') : ''),
684
+ persona: options.persona,
685
+ template: scenario?.id,
686
+ }, workspaceExemplars)
687
+ : (options.exemplar !== undefined && options.exemplar !== null && options.exemplar !== ''
688
+ ? resolveExemplar(options.exemplar, workspaceExemplars)
689
+ : null)
678
690
  if (options.exemplar !== undefined && options.exemplar !== null && options.exemplar !== '' && !resolvedExemplar) {
679
691
  fail('未知标杆范本 exemplar:' + String(options.exemplar))
680
692
  }