@cloud411716/fancy-webnovel 0.3.3 → 0.3.5

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.3",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -68,7 +68,7 @@ export async function apply(ctx) {
68
68
  : rawChoices;
69
69
 
70
70
  // 把 rankId 转换成 { channel, type } 并去重
71
- const rankEntries = rankIds.map(id => parseRankId(platform, id));
71
+ const rankEntries = rankIds.map(id => parseRankId(platform, resolveId(platform, id)));
72
72
  const unique = [];
73
73
  const seen = new Set();
74
74
  for (const e of rankEntries) {
@@ -79,6 +79,7 @@ export async function apply(ctx) {
79
79
  // ---------- 串行采集 ----------
80
80
  let allFiles = [];
81
81
  let failed = 0;
82
+ let lastReceipt = null;
82
83
 
83
84
  for (const rank of unique) {
84
85
  const stop = startActivity(session);
@@ -119,20 +120,27 @@ export async function apply(ctx) {
119
120
  failed++;
120
121
  continue;
121
122
  }
122
- const files = receipt.scan_files || [];
123
- allFiles = allFiles.concat(files);
124
-
125
- // 逐个文件追加到 topic_decision
126
- const topicFile = receipt.topic_decision || '';
127
- if (topicFile) {
128
- notify(session, scan.notify({ type: 'handover', platform, files, topicFile, projectRoot }));
129
- const prompt = scan.llmAnalysisPrompt({ platform, date: receipt.date || '', files, topicFile, projectRoot });
130
- llmFollowup(invocation, prompt);
131
- }
123
+ lastReceipt = receipt;
124
+ allFiles = allFiles.concat(receipt.scan_files || []);
132
125
  }
133
126
 
134
- if (failed > 0 && allFiles.length === 0) {
135
- return { kind: 'success', text: '' };
127
+ // ---------- 全部采集完成后统一输出 ----------
128
+ if (allFiles.length > 0 && lastReceipt) {
129
+ notify(session, scan.notify({
130
+ type: 'handover',
131
+ platform,
132
+ files: allFiles,
133
+ topicFile: lastReceipt.topic_decision || '',
134
+ projectRoot,
135
+ }));
136
+ const prompt = scan.llmAnalysisPrompt({
137
+ platform,
138
+ date: lastReceipt.date || '',
139
+ files: allFiles,
140
+ topicFile: lastReceipt.topic_decision || '',
141
+ projectRoot,
142
+ });
143
+ llmFollowup(invocation, prompt);
136
144
  }
137
145
 
138
146
  return { kind: 'success', text: '' };
@@ -144,6 +152,16 @@ export async function apply(ctx) {
144
152
  // 将 rankId 转换成 { channel, type } 参数
145
153
  // ---------------------------------------------------------------------------
146
154
 
155
+ // 将 label 或 id 统一成 id(UI 可能返回 label)
156
+ function resolveId(platform, raw) {
157
+ const opts = rankOptions(platform);
158
+ const byId = opts.find(o => o.id === raw);
159
+ if (byId) return byId.id;
160
+ const byLabel = opts.find(o => o.label === raw);
161
+ if (byLabel) return byLabel.id;
162
+ return raw; // 未知值直接透传
163
+ }
164
+
147
165
  function parseRankId(platform, id) {
148
166
  switch (platform) {
149
167
  case 'qimao': {