| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #!/usr/bin/env node
- const fs = require('fs');
- const os = require('os');
- const path = require('path');
- const { runTihaoSourcing } = require('../mcp/src/tools/tihao-brief-sourcing-run');
- async function main() {
- const output = fs.mkdtempSync(path.join(os.tmpdir(), 'tihao-platform-strategy-'));
- const result = await runTihaoSourcing({
- collectionMode: 'sample',
- briefText: [
- '客户名称:平台策略测试',
- '平台与人数:小红书 4 人,抖音 3 人',
- '产品:敏感肌屏障修护精华',
- '参考账号:小红书成分党参考账号,抖音生活方式参考账号',
- '关键词:敏感肌、屏障修护、真实体验、成分拆解',
- '偏好真实体验、成分拆解,不要硬广。'
- ].join('\n'),
- output
- });
- assert(result.status === 'ok', 'platform strategy smoke should run ok');
- const strategies = result.data.criteria.sourcingStrategy || [];
- const xhs = strategies.find(item => item.platform === 'xiaohongshu');
- const douyin = strategies.find(item => item.platform === 'douyin');
- assert(xhs, 'sourcing strategy should include xiaohongshu');
- assert(douyin, 'sourcing strategy should include douyin');
- assert(xhs.preferredPath === 'reference_similarity', 'xiaohongshu should prefer reference similarity path');
- assert(String(xhs.note || '').includes('蒲公英'), 'xiaohongshu note should mention Pugongying/reference path');
- assert(String(xhs.note || '').includes('相似'), 'xiaohongshu note should mention similar account recommendation');
- assert(douyin.preferredPath === 'keyword_or_recruitment', 'douyin should use keyword/recruitment path');
- assert(String(douyin.note || '').includes('星图'), 'douyin note should mention Xingtu tags as entry only');
- assert(String(douyin.note || '').includes('招募'), 'douyin note should mention recruitment fallback');
- assert(String(douyin.note || '').includes('不作为适配证明'), 'douyin note should not treat Xingtu tags as fit proof');
- const report = fs.readFileSync(path.join(output, 'tihao-sourcing-report.md'), 'utf8');
- assert(report.includes('平台找号策略'), 'report should expose platform sourcing strategy');
- assert(report.includes('小红书/蒲公英优先使用参考账号相似推荐'), 'report should explain xiaohongshu reference-similarity path');
- assert(report.includes('抖音星图标签只作为候选入口'), 'report should explain douyin xingtu limitation');
- assert(report.includes('招募补量'), 'report should explain douyin recruitment fallback');
- console.log(`platform sourcing strategy smoke ok: ${output}`);
- }
- function assert(condition, message) {
- if (!condition) throw new Error(message);
- }
- main().catch(error => {
- console.error(error && error.stack ? error.stack : String(error));
- process.exit(1);
- });
|