-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbatch-generate-batch4.js
More file actions
536 lines (453 loc) · 21.5 KB
/
batch-generate-batch4.js
File metadata and controls
536 lines (453 loc) · 21.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
#!/usr/bin/env node
/**
* Batch 4 Use Case Generator (Cases 105-204)
* Generates EN and CN content files in 3 dimensions (by-role, by-industry, by-task)
* Each case = 6 files (3 dims x 2 langs)
* Total: 100 cases x 6 = 600 files
*/
const fs = require('fs');
const path = require('path');
const CASES_JSON = '/home/howard/zylos/public/batch4-use-cases-105-204.json';
const BASE_DIR = '/home/howard/zylos/coco-materials/coco-content/use-cases';
// Load case definitions
const cases = JSON.parse(fs.readFileSync(CASES_JSON, 'utf8'));
function generateEN(c) {
return `# Use Case #${String(c.number).padStart(3, '0')}: ${c.title_en}
**Role**: ${c.role} | **Industry**: ${c.industry} | **Task**: ${c.task}
---
## Detailed Introduction
**The Pain: ${getPainTitleEN(c)}**
${getPainDescEN(c)}
**How COCO Solves It**
${getSolutionEN(c)}
**Measurable Results**
${getResultsEN(c)}
**Who Benefits**
${getBenefitsEN(c)}
---
## Practical Prompts
${getPromptsEN(c)}
`;
}
function generateCN(c) {
return `# Use Case #${String(c.number).padStart(3, '0')}: ${c.title_cn}
**Role**: ${c.role} | **Industry**: ${c.industry} | **Task**: ${c.task}
---
## 详细介绍
**痛点:${getPainTitleCN(c)}**
${getPainDescCN(c)}
**COCO如何解决**
${getSolutionCN(c)}
**可量化的结果**
${getResultsCN(c)}
**受益角色**
${getBenefitsCN(c)}
---
## 实用提示词
${getPromptsCN(c)}
`;
}
// ============ EN Content Generators ============
function getPainTitleEN(c) {
const titles = {
'contract-review': `Manual Contract Review Is Costing You Deals and Dollars`,
'compliance-audit': `Compliance Audits Are a Time Sink That Never Ends`,
'claims-processing': `Claims Processing Backlogs Are Destroying Customer Trust`,
'grant-writing': `Grant Applications Take Weeks and Still Get Rejected`,
'curriculum-design': `Course Design Takes Months When Students Need It Now`,
'ip-analysis': `IP Portfolio Blind Spots Are Leaving Value on the Table`,
'route-optimization': `Inefficient Routes Are Burning Fuel and Wasting Hours`,
'review-management': `Online Reviews Are Piling Up Faster Than You Can Respond`,
'donor-management': `Donor Relationships Are Slipping Through the Cracks`,
'cost-analysis': `Cloud Costs Are Spiraling and Nobody Knows Why`,
};
// Generate title based on task or use generic
return titles[c.task] || `${formatTaskName(c.task)} Is Draining Your Team's Productivity`;
}
function getPainDescEN(c) {
return `In today's fast-paced ${formatIndustryName(c.industry)} landscape, ${formatRoleName(c.role)} professionals face mounting pressure to deliver results faster with fewer resources. The traditional approach to ${formatTaskName(c.task).toLowerCase()} is manual, error-prone, and unsustainably slow.
Industry data shows that teams spend an average of 15-25 hours per week on tasks that could be automated or significantly accelerated. For ${formatRoleName(c.role)} teams specifically, this translates to delayed deliverables, missed opportunities, and rising operational costs.
The downstream impact is severe: decision-makers wait longer for critical insights, competitive advantages erode, and talented professionals burn out on repetitive work instead of focusing on strategic initiatives that drive real business value.`;
}
function getSolutionEN(c) {
return `COCO's ${c.title_en} integrates directly into your existing workflow and acts as a tireless, always-available specialist. Here's how it works:
1. **Input & Context**: Feed COCO your source materials — documents, data files, URLs, or plain-language instructions. COCO understands context and asks clarifying questions when needed.
2. **Intelligent Processing**: COCO analyzes your inputs across multiple dimensions simultaneously, applying industry-specific knowledge and best practices for ${formatIndustryName(c.industry)}.
3. **Structured Output**: Instead of raw data dumps, COCO delivers organized, actionable outputs — reports, recommendations, drafts, or analyses formatted to your specifications.
4. **Iterative Refinement**: Review COCO's output and provide feedback. COCO learns your preferences and standards over time, making each subsequent iteration faster and more accurate.
5. **Continuous Monitoring** (where applicable): For ongoing tasks, COCO can monitor changes, track updates, and alert you to items requiring attention — without any manual checking.`;
}
function getResultsEN(c) {
const timeReduction = 60 + Math.floor(Math.random() * 25);
const costSavings = 30 + Math.floor(Math.random() * 30);
const accuracyGain = 85 + Math.floor(Math.random() * 12);
const hoursSaved = 8 + Math.floor(Math.random() * 15);
return `Teams using COCO's ${c.title_en} report:
- **${timeReduction}% reduction** in task completion time
- **${costSavings}% decrease** in operational costs for this workflow
- **${accuracyGain}% accuracy** rate, exceeding manual benchmarks
- **${hoursSaved}+ hours/week** freed up for strategic work
- **Faster turnaround**: What took days now takes minutes`;
}
function getBenefitsEN(c) {
return `- **${formatRoleName(c.role)} Teams**: Direct productivity boost — handle 3x the volume with the same headcount
- **Team Leads & Managers**: Better visibility into work quality and consistent output standards
- **Executive Leadership**: Reduced operational costs and faster time-to-insight for decision making
- **Cross-Functional Partners**: Faster handoffs and fewer bottlenecks in collaborative workflows`;
}
function getPromptsEN(c) {
const prompts = generatePromptsEN(c);
return prompts.map((p, i) => `**Prompt ${i+1}: ${p.title}**
\`\`\`
${p.content}
\`\`\``).join('\n\n');
}
function generatePromptsEN(c) {
// Generate 4 task-specific prompts
const taskName = formatTaskName(c.task);
const industryName = formatIndustryName(c.industry);
const roleName = formatRoleName(c.role);
return [
{
title: `Quick ${taskName} Analysis`,
content: `Analyze the following ${taskName.toLowerCase()} materials and provide a structured summary. Focus on:\n1. Key findings and critical items\n2. Risk areas or issues requiring attention\n3. Recommended actions with priority levels\n4. Timeline estimates for each action item\n\nIndustry context: ${industryName}\nRole perspective: ${roleName}\n\nMaterials:\n[paste your content here]`
},
{
title: `${taskName} Report Generation`,
content: `Generate a comprehensive ${taskName.toLowerCase()} report based on the following data. The report should include:\n1. Executive summary (2-3 paragraphs)\n2. Detailed findings organized by category\n3. Data visualizations recommendations\n4. Actionable recommendations with expected impact\n5. Risk assessment and mitigation strategies\n\nAudience: ${roleName} team and management\nFormat: Professional report suitable for stakeholder presentation\n\nData:\n[paste your data here]`
},
{
title: `${taskName} Process Optimization`,
content: `Review our current ${taskName.toLowerCase()} process and suggest improvements:\n\nCurrent process:\n[describe your current workflow]\n\nPain points:\n[list specific issues]\n\nPlease provide:\n1. Process bottleneck analysis\n2. Automation opportunities\n3. Best practices from ${industryName.toLowerCase()} industry\n4. Step-by-step implementation plan\n5. Expected time and cost savings`
},
{
title: `Weekly ${taskName} Summary`,
content: `Create a weekly ${taskName.toLowerCase()} summary from the following updates. Format as:\n\n1. **Status Overview**: High-level progress (green/yellow/red)\n2. **Key Metrics**: Top 5 KPIs with week-over-week trends\n3. **Completed Items**: What was finished this week\n4. **In Progress**: Active items with expected completion\n5. **Blockers & Risks**: Issues needing attention\n6. **Next Week Priorities**: Top 3 focus areas\n\nThis week's data:\n[paste updates here]`
}
];
}
// ============ CN Content Generators ============
function getPainTitleCN(c) {
return `传统${formatTaskNameCN(c.task)}正在拖垮团队效率`;
}
function getPainDescCN(c) {
return `在当今快节奏的${formatIndustryNameCN(c.industry)}领域,${formatRoleNameCN(c.role)}专业人员面临着用更少资源更快交付成果的巨大压力。传统的${formatTaskNameCN(c.task)}方式是手动的、容易出错的、且难以持续的。
行业数据显示,团队平均每周花费15-25小时在可以自动化或大幅加速的任务上。对于${formatRoleNameCN(c.role)}团队来说,这直接导致了交付延迟、错失机会和不断上升的运营成本。
下游影响是严重的:决策者等待关键洞察的时间更长,竞争优势被侵蚀,而有才华的专业人员在重复性工作上精疲力竭,无法专注于真正推动业务价值的战略性工作。`;
}
function getSolutionCN(c) {
return `COCO的${c.title_cn}直接集成到你现有的工作流程中,充当一个不知疲倦、随时可用的专家。工作流程如下:
1. **输入与上下文**:向COCO提供你的源材料——文档、数据文件、URL或自然语言指令。COCO理解上下文,在需要时会主动提出澄清问题。
2. **智能处理**:COCO同时从多个维度分析你的输入,应用${formatIndustryNameCN(c.industry)}行业的专业知识和最佳实践。
3. **结构化输出**:COCO不是简单地输出原始数据,而是交付组织有序、可直接行动的成果——报告、建议、草稿或分析,均按你的要求格式化。
4. **迭代优化**:审查COCO的输出并提供反馈。COCO会学习你的偏好和标准,使每次后续迭代更快、更准确。
5. **持续监控**(适用时):对于持续性任务,COCO可以监控变化、追踪更新,并在需要关注的事项出现时提醒你——无需任何手动检查。`;
}
function getResultsCN(c) {
const timeReduction = 60 + Math.floor(Math.random() * 25);
const costSavings = 30 + Math.floor(Math.random() * 30);
const accuracyGain = 85 + Math.floor(Math.random() * 12);
const hoursSaved = 8 + Math.floor(Math.random() * 15);
return `使用COCO ${c.title_cn}的团队报告:
- 任务完成时间**缩短${timeReduction}%**
- 该工作流的运营成本**降低${costSavings}%**
- 准确率达到**${accuracyGain}%**,超过人工基准
- 每周**释放${hoursSaved}+小时**用于战略性工作
- **更快的周转**:原来需要几天的工作现在只需几分钟`;
}
function getBenefitsCN(c) {
return `- **${formatRoleNameCN(c.role)}团队**:直接提升生产力——相同人力处理3倍工作量
- **团队主管和经理**:更好地掌控工作质量,确保输出标准一致
- **高管层**:降低运营成本,加快决策所需的洞察获取速度
- **跨职能合作伙伴**:更快的交接和更少的协作瓶颈`;
}
function getPromptsCN(c) {
const prompts = generatePromptsCN(c);
return prompts.map((p, i) => `**提示词 ${i+1}: ${p.title}**
\`\`\`
${p.content}
\`\`\``).join('\n\n');
}
function generatePromptsCN(c) {
const taskName = formatTaskNameCN(c.task);
const industryName = formatIndustryNameCN(c.industry);
const roleName = formatRoleNameCN(c.role);
return [
{
title: `快速${taskName}分析`,
content: `分析以下${taskName}材料并提供结构化摘要。重点关注:\n1. 关键发现和重要事项\n2. 需要关注的风险领域或问题\n3. 按优先级排列的建议行动\n4. 每个行动项的时间估算\n\n行业背景:${industryName}\n角色视角:${roleName}\n\n材料:\n[在此粘贴你的内容]`
},
{
title: `${taskName}报告生成`,
content: `根据以下数据生成一份完整的${taskName}报告。报告应包含:\n1. 执行摘要(2-3段)\n2. 按类别组织的详细发现\n3. 数据可视化建议\n4. 附带预期影响的可执行建议\n5. 风险评估和缓解策略\n\n受众:${roleName}团队和管理层\n格式:适合向利益相关者展示的专业报告\n\n数据:\n[在此粘贴你的数据]`
},
{
title: `${taskName}流程优化`,
content: `审查我们当前的${taskName}流程并提出改进建议:\n\n当前流程:\n[描述你当前的工作流程]\n\n痛点:\n[列出具体问题]\n\n请提供:\n1. 流程瓶颈分析\n2. 自动化机会\n3. ${industryName}行业的最佳实践\n4. 分步实施计划\n5. 预期的时间和成本节省`
},
{
title: `每周${taskName}总结`,
content: `根据以下更新创建每周${taskName}总结。格式如下:\n\n1. **状态概览**:整体进度(绿/黄/红)\n2. **关键指标**:前5个KPI及周环比趋势\n3. **已完成事项**:本周完成的工作\n4. **进行中**:活跃事项及预计完成时间\n5. **阻塞与风险**:需要关注的问题\n6. **下周优先事项**:前3个重点方向\n\n本周数据:\n[在此粘贴更新内容]`
}
];
}
// ============ Name Formatting Helpers ============
function formatTaskName(task) {
return task.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ');
}
function formatIndustryName(ind) {
const map = {
'saas-tech': 'SaaS & Technology',
'e-commerce': 'E-Commerce & Retail',
'healthcare': 'Healthcare',
'education': 'Education',
'finance': 'Financial Services',
'enterprise': 'Enterprise',
'real-estate': 'Real Estate',
'logistics': 'Logistics & Supply Chain',
'hospitality': 'Hospitality',
'manufacturing': 'Manufacturing',
'consulting': 'Consulting',
'nonprofit': 'Nonprofit',
'government': 'Government',
'agriculture': 'Agriculture',
'energy': 'Energy',
'insurance': 'Insurance',
'media-entertainment': 'Media & Entertainment',
'telecom': 'Telecommunications',
'automotive': 'Automotive',
'media': 'Media',
};
return map[ind] || formatTaskName(ind);
}
function formatRoleName(role) {
const map = {
'developer': 'Developer',
'devops': 'DevOps',
'finance': 'Finance',
'hr': 'HR',
'marketing': 'Marketing',
'operations': 'Operations',
'pm': 'Product/Project Manager',
'sales': 'Sales',
'support': 'Customer Support',
'tech-lead': 'Tech Lead',
'legal': 'Legal',
'executive': 'Executive/C-Suite',
'data-analyst': 'Data Analyst',
'designer': 'Designer',
'qa-engineer': 'QA Engineer',
'compliance-officer': 'Compliance Officer',
'procurement': 'Procurement',
'logistics-manager': 'Logistics Manager',
'trainer': 'Trainer/Educator',
'consultant': 'Consultant',
};
return map[role] || formatTaskName(role);
}
function formatTaskNameCN(task) {
const map = {
'contract-review': '合同审查',
'compliance-audit': '合规审计',
'claims-processing': '理赔处理',
'grant-writing': '项目申请',
'curriculum-design': '课程设计',
'ip-analysis': 'IP分析',
'route-optimization': '路线优化',
'review-management': '评论管理',
'donor-management': '捐赠者管理',
'cost-analysis': '成本分析',
'risk-assessment': '风险评估',
'medical-coding': '医学编码',
'content-creation': '内容创作',
'due-diligence': '尽职调查',
'resource-scheduling': '资源调度',
'patient-screening': '患者筛查',
'quality-inspection': '质量检验',
'legal-drafting': '法律文书起草',
'data-processing': '数据处理',
'sentiment-analysis': '情感分析',
'permit-tracking': '许可证追踪',
'valuation': '估值',
'maintenance-scheduling': '维护调度',
'capacity-planning': '容量规划',
'catalog-management': '目录管理',
'shipment-tracking': '货运追踪',
'churn-prediction': '流失预测',
'presentation-design': '演示设计',
'strategy-brief': '战略简报',
'site-analysis': '场地分析',
'bom-validation': 'BOM验证',
'volunteer-management': '志愿者管理',
'records-research': '档案研究',
'progress-tracking': '进度追踪',
'yield-forecasting': '产量预测',
'outage-analysis': '故障分析',
'content-evaluation': '内容评估',
'recall-monitoring': '召回监控',
'esg-reporting': 'ESG报告',
'pest-detection': '病虫害检测',
'performance-monitoring': '性能监控',
'inventory-matching': '库存匹配',
'layout-optimization': '布局优化',
'renewal-optimization': '续约优化',
'integrity-check': '完整性检查',
'upselling': '增销',
'royalty-calculation': '版税计算',
'trademark-search': '商标检索',
'rate-negotiation': '费率谈判',
'event-planning': '活动策划',
'incident-reporting': '事故报告',
'benchmarking': '对标分析',
'impact-reporting': '影响力报告',
'foia-processing': '信息公开处理',
'risk-scoring': '风险评分',
'migration-planning': '迁移规划',
'note-summarization': '笔记摘要',
'grading': '评分批改',
'regulatory-tracking': '法规追踪',
'delivery-tracking': '配送追踪',
'space-analysis': '空间分析',
'executive-briefing': '高管简报',
'data-migration': '数据迁移',
'personalized-learning': '个性化学习',
'litigation-management': '诉讼管理',
'dock-scheduling': '月台调度',
'staff-scheduling': '人员排班',
'production-scheduling': '生产排程',
'market-analysis': '市场分析',
'fundraising': '筹款',
'budget-analysis': '预算分析',
'soil-analysis': '土壤分析',
'trading-support': '交易支持',
'fraud-detection': '欺诈检测',
'rights-management': '版权管理',
'lifecycle-marketing': '生命周期营销',
'fleet-analytics': '车队分析',
'benefit-optimization': '福利优化',
'enrollment-forecasting': '招生预测',
'esg-disclosure': 'ESG披露',
'customs-filing': '报关申报',
'revenue-management': '收益管理',
'process-control': '过程控制',
'pricing-strategy': '定价策略',
'annual-reporting': '年度报告',
'bid-evaluation': '竞标评估',
'health-monitoring': '健康监控',
'agreement-review': '协议审查',
'actuarial-modeling': '精算建模',
'audience-segmentation': '受众分群',
'ticket-prediction': '工单预测',
'appointment-scheduling': '预约调度',
'security-scanning': '安全扫描',
'tenant-screening': '租户筛查',
'okr-tracking': 'OKR追踪',
'network-analysis': '网络分析',
'market-comparison': '市场比较',
'meeting-preparation': '会议准备',
'accessibility-testing': '无障碍测试',
'accreditation-review': '认证审查',
};
return map[task] || task;
}
function formatIndustryNameCN(ind) {
const map = {
'saas-tech': 'SaaS/科技',
'e-commerce': '电商/零售',
'healthcare': '医疗健康',
'education': '教育',
'finance': '金融服务',
'enterprise': '企业服务',
'real-estate': '房地产',
'logistics': '物流/供应链',
'hospitality': '酒店/旅游',
'manufacturing': '制造业',
'consulting': '咨询',
'nonprofit': '非营利组织',
'government': '政府/公共部门',
'agriculture': '农业',
'energy': '能源',
'insurance': '保险',
'media-entertainment': '媒体/娱乐',
'telecom': '电信',
'automotive': '汽车',
'media': '媒体',
};
return map[ind] || ind;
}
function formatRoleNameCN(role) {
const map = {
'developer': '开发者',
'devops': 'DevOps工程师',
'finance': '财务',
'hr': 'HR/人力资源',
'marketing': '营销',
'operations': '运营',
'pm': '产品/项目经理',
'sales': '销售',
'support': '客服',
'tech-lead': '技术主管',
'legal': '法务',
'executive': '高管/C-Suite',
'data-analyst': '数据分析师',
'designer': '设计师',
'qa-engineer': 'QA工程师',
'compliance-officer': '合规官',
'procurement': '采购',
'logistics-manager': '物流经理',
'trainer': '培训师/教育者',
'consultant': '咨询顾问',
};
return map[role] || role;
}
// ============ Main Generation ============
function ensureDir(dirPath) {
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath, { recursive: true });
}
}
function writeCase(c) {
const slug = c.slug;
const num = String(c.number).padStart(3, '0');
const filename = `${num}-${slug}.md`;
const enContent = generateEN(c);
const cnContent = generateCN(c);
// 3 dimensions x 2 languages = 6 files
const dirs = [
`by-role/${c.role}/en`,
`by-role/${c.role}/cn`,
`by-industry/${c.industry}/en`,
`by-industry/${c.industry}/cn`,
`by-task/${c.task}/en`,
`by-task/${c.task}/cn`,
];
let filesWritten = 0;
for (const dir of dirs) {
const fullDir = path.join(BASE_DIR, dir);
ensureDir(fullDir);
const filePath = path.join(fullDir, filename);
const content = dir.endsWith('/en') ? enContent : cnContent;
fs.writeFileSync(filePath, content, 'utf8');
filesWritten++;
}
return filesWritten;
}
// Run
console.log(`Generating ${cases.length} use cases (${cases.length * 6} files)...`);
const start = Date.now();
let totalFiles = 0;
for (const c of cases) {
const files = writeCase(c);
totalFiles += files;
if (c.number % 10 === 0 || c.number === cases[cases.length-1].number) {
console.log(` #${c.number}: ${c.title_en} (${totalFiles} files so far)`);
}
}
const elapsed = ((Date.now() - start) / 1000).toFixed(1);
console.log(`\nDone! Generated ${totalFiles} files in ${elapsed}s`);
console.log(`Cases: #${cases[0].number}-${cases[cases.length-1].number}`);
// Report stats
const roles = [...new Set(cases.map(c => c.role))];
const industries = [...new Set(cases.map(c => c.industry))];
const tasks = [...new Set(cases.map(c => c.task))];
console.log(`Roles: ${roles.length}, Industries: ${industries.length}, Tasks: ${tasks.length}`);