@cloud411716/fancy-webnovel 0.3.5 → 0.3.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -78,8 +78,8 @@ export async function apply(ctx) {
78
78
 
79
79
  // ---------- 串行采集 ----------
80
80
  let allFiles = [];
81
- let failed = 0;
82
81
  let lastReceipt = null;
82
+ const failedRanks = []; // 收集失败项:{ rank, err }
83
83
 
84
84
  for (const rank of unique) {
85
85
  const stop = startActivity(session);
@@ -108,16 +108,14 @@ export async function apply(ctx) {
108
108
  );
109
109
  return { kind: 'success', text: '' };
110
110
  }
111
- notify(session, scan.notify({ type: 'failed', err: rawErr }));
112
- failed++;
111
+ failedRanks.push({ rank, err: rawErr });
113
112
  continue;
114
113
  }
115
114
 
116
115
  // 解析采集结果
117
116
  let receipt;
118
117
  try { receipt = JSON.parse(r.output); } catch (_) {
119
- notify(session, scan.notify({ type: 'parse_error' }));
120
- failed++;
118
+ failedRanks.push({ rank, err: 'JSON 解析失败' });
121
119
  continue;
122
120
  }
123
121
  lastReceipt = receipt;
@@ -143,6 +141,15 @@ export async function apply(ctx) {
143
141
  llmFollowup(invocation, prompt);
144
142
  }
145
143
 
144
+ // 统一展示所有失败项
145
+ if (failedRanks.length > 0) {
146
+ const lines = failedRanks.map(({ rank, err }) => {
147
+ const label = `${rank.channel}/${rank.type}`;
148
+ return `• ${label}:${err}`;
149
+ });
150
+ notify(session, `⚠️ 以下榜单采集失败(共 ${failedRanks.length} 项):\n${lines.join('\n')}`);
151
+ }
152
+
146
153
  return { kind: 'success', text: '' };
147
154
  },
148
155
  });
@@ -146,7 +146,7 @@ export const scan = {
146
146
  `2. 分析爆款书籍的题材、卖点、节奏、人设等特征`,
147
147
  `3. 生成扫榜报告(包含:市场趋势、热门题材分析、用户画像、竞争度评估)`,
148
148
  `4. 给出 3-5 个可行的选题方向建议`,
149
- `5. 将完整分析报告追加写入:${topicFile}`,
149
+ `5. 将完整分析报告追加写入:${topicFile}(如文件不存在则先新建再追加)`,
150
150
  ``,
151
151
  `报告要求:`,
152
152
  `- 客观分析数据,不臆测`,