diff --git a/scripts/trigger-news-morning-global-regenerate.mjs b/scripts/trigger-news-morning-global-regenerate.mjs index 19dabf4..c916090 100644 --- a/scripts/trigger-news-morning-global-regenerate.mjs +++ b/scripts/trigger-news-morning-global-regenerate.mjs @@ -1,6 +1,6 @@ #!/usr/bin/env node /** - * Enable global-source news morning template and trigger prod worker regenerate + push. + * Enable full-source news morning template and trigger prod worker regenerate + push. */ import process from 'node:process'; import mysql from 'mysql2/promise'; @@ -29,13 +29,12 @@ async function main() { enabled: current.enabled !== false, forceGenerateOnce: true, taskSpecAppend: [ - '【全球扩展栏目 · 必须生成】', - '除原有栏目外,必须新增并写满以下 4 个 section(quick-link + div.section):', - '1. id=google:「🔎 Google 热点 · Global Headlines」2~3 条,标题可英文,正文中文摘要,来源 Reuters/BBC/AP/Google News 等;', - '2. id=x:「𝕏 X 平台热点 · Trending」2~3 条,X/Twitter 热议或媒体转述,标题可中英混合;', - '3. id=universities:「🎓 全球高校 · Research & Campus」2~3 条,MIT/Stanford/Oxford 等科研或校园新闻,标题可英文;', - '4. id=global_markets:「📈 全球股市 · Markets」2~3 条,美股/欧股/日股/港股等,可含 Fed/Nasdaq/FTSE 等英文术语;', - '英文栏目标题可英文或中英并列,每条必须有中文摘要与来源 URL;禁止整段纯英文正文。', + '【全渠道扩展 · 必须生成且全页去重】', + '除原有栏目外,必须新增并写满以下 section(quick-link + div.section),每条 2 card(crypto 有则 1~2,无则可省略 section):', + 'asia_pacific / commodities / ai_chips / policy / community / science / culture / startup / crypto / geopolitics / local_life / official_feeds,', + '以及 google / x / universities / global_markets。', + '全页去重:同一 URL 或同一核心事件只允许出现一次;主栏目优先,扩展栏目必须换角度或跳过。', + '英文栏目标题可英文,每条必须有中文摘要与来源 URL;禁止整段纯英文正文。', ].join('\n'), }; const now = Date.now(); @@ -46,13 +45,13 @@ async function main() { config_json = VALUES(config_json), updated_by = VALUES(updated_by), updated_at = VALUES(updated_at)`, - [CONFIG_KEY, JSON.stringify(next), 'global-source-regenerate', now], + [CONFIG_KEY, JSON.stringify(next), 'full-source-regenerate', now], ); console.log(JSON.stringify({ ok: true, forceGenerateOnce: true, taskSpecAppendChars: next.taskSpecAppend.length, - templateNote: 'Worker on 143 must run code with taskSpecAppend + new search queries for full effect.', + templateNote: 'Worker must run code with full template + dedupe prefetch for best effect.', }, null, 2)); await pool.end(); } diff --git a/wechat-daily-news-inline.mjs b/wechat-daily-news-inline.mjs index 799f839..6b87edc 100644 --- a/wechat-daily-news-inline.mjs +++ b/wechat-daily-news-inline.mjs @@ -33,6 +33,21 @@ const SECTION_LABELS = { world: 'WORLD', domestic: 'CHINA', google: 'GLOBAL', + x: 'SOCIAL', + asia_pacific: 'ASIA', + commodities: 'ENERGY', + ai_chips: 'AI', + policy: 'POLICY', + universities: 'CAMPUS', + global_markets: 'MARKETS', + community: 'COMMUNITY', + science: 'SCIENCE', + culture: 'CULTURE', + startup: 'STARTUP', + crypto: 'CRYPTO', + geopolitics: 'GEOPOL', + local_life: 'CITIES', + official_feeds: 'WIRE', finance: 'FINANCE', tech: 'TECH', technews: 'TECH', @@ -547,16 +562,31 @@ function renderGenericSection( } const DEFAULT_SECTION_CARD_LIMITS = { - headlines: 7, - world: 5, - domestic: 5, - google: 3, - finance: 5, - tech: 5, - sports: 3, + headlines: 6, + world: 4, + domestic: 4, + google: 2, + x: 2, + asia_pacific: 2, + commodities: 2, + ai_chips: 2, + policy: 2, + universities: 2, + global_markets: 2, + community: 2, + science: 2, + culture: 2, + startup: 2, + crypto: 2, + geopolitics: 2, + local_life: 2, + official_feeds: 2, + finance: 4, + tech: 4, + sports: 2, technews: 2, - hot: 3, - knowledge: 4, + hot: 2, + knowledge: 3, }; const DEFAULT_CARD_BODY_CHARS = 150; @@ -593,13 +623,28 @@ const TRIM_PROFILES = CARD_LIMIT_TIERS.map((sectionCardLimits, index) => ({ * 知识小卡片、体育、热搜等补充栏目先让位,保证各栏目都还有内容。 */ const SECTION_SHRINK_WEIGHTS = { - knowledge: 1.6, - sports: 1.4, - hot: 1.35, - google: 1.3, - technews: 1.3, + knowledge: 1.7, + culture: 1.65, + community: 1.62, + crypto: 1.6, + local_life: 1.58, + startup: 1.55, + science: 1.5, + sports: 1.45, + hot: 1.4, + x: 1.38, + google: 1.35, + official_feeds: 1.33, + asia_pacific: 1.3, + commodities: 1.28, + universities: 1.25, + ai_chips: 1.2, + geopolitics: 1.15, + policy: 1.1, + global_markets: 1.08, + technews: 1.05, tech: 1, - finance: 1, + finance: 0.95, world: 0.9, domestic: 0.9, headlines: 0.65, @@ -879,7 +924,22 @@ function fitInlineContentToBudget(html, bodyBudget, { const fallbackProfile = { ...BASE_TRIM_FLAGS, skipKnowledge: true, - sectionCardLimits: { headlines: 3, world: 2, domestic: 2, google: 1, finance: 2, tech: 2, sports: 1, technews: 1, hot: 1, knowledge: 0 }, + sectionCardLimits: { + headlines: 3, + world: 2, + domestic: 2, + google: 1, + x: 1, + asia_pacific: 1, + finance: 2, + tech: 2, + ai_chips: 1, + global_markets: 1, + sports: 1, + technews: 1, + hot: 1, + knowledge: 0, + }, maxBodyChars: 80, }; const built = render(fallbackProfile); diff --git a/wechat-news-morning-draft.mjs b/wechat-news-morning-draft.mjs index 462bf7d..d8b46fe 100644 --- a/wechat-news-morning-draft.mjs +++ b/wechat-news-morning-draft.mjs @@ -33,7 +33,7 @@ const MAX_THUMB_BYTES = 64 * 1024; export const NEWS_MORNING_TEMPLATE_REFERENCE_URL = 'https://m.tkmind.cn/MindSpace/a70ff537-8908-486e-9b6c-042e07cc25db/public/daily-news-0915.html'; -export const NEWS_MORNING_TEMPLATE_VERSION = '2026-09-18-global'; +export const NEWS_MORNING_TEMPLATE_VERSION = '2026-09-18-full'; /** 生产 daily-news-0915 版式:div.section + 扩展全球栏目。 */ export const NEWS_MORNING_TEMPLATE_0915_SPEC = [ @@ -41,23 +41,36 @@ export const NEWS_MORNING_TEMPLATE_0915_SPEC = [ `参照页:${NEWS_MORNING_TEMPLATE_REFERENCE_URL}`, '写页前可先 read_file 打开同目录最近 daily-news-*.html 或上述 URL 对应文件,对照 CSS 与 DOM 骨架;正文条目必须全部来自当日检索。', '1. 外层:`.wrap` > `.hero`(`.hero-content` 内 h1「📰 每日新闻早报」、`.date-badge`、`.subtitle` 一句主编导语)> `.container`。', - '2. quick-links 固定顺序:📰 要闻|🌤️ 天气|🌍 国际|🇨🇳 国内|💰 财经|🤖 科技|🏆 体育|🔥 热搜|🔎 Google|𝕏 X|🎓 高校|📈 全球股市|📚 小知识|📅 历史(href 对应下方 id)。', + '2. quick-links 固定顺序:📰 要闻|🌤️ 天气|🌍 国际|🇨🇳 国内|💰 财经|🤖 科技|🏆 体育|🔥 热搜|🔎 Google|𝕏 X|🌏 亚太|⛽ 能源|🧠 AI芯片|⚖️ 政策|🎓 高校|📈 全球股市|💬 社区|🔬 科学|🎬 文娱|🚀 创投|₿ 加密|🛡️ 地缘|🏙️ 城市|📡 权威快讯|📚 小知识|📅 历史(href 对应下方 id)。', '3. 区块容器必须用 `