@cloud411716/fancy-webnovel 1.0.43 → 1.0.44
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.
|
@@ -13,7 +13,7 @@ import { initProject } from './init-project.js';
|
|
|
13
13
|
// inject is declared in the root index.js; only apply() is imported by index.js
|
|
14
14
|
|
|
15
15
|
/** UserQuestionError codes that indicate user cancellation */
|
|
16
|
-
const USER_CANCEL_CODES = new Set(['ASK_CANCELLED', 'ASK_ABORTED']);
|
|
16
|
+
const USER_CANCEL_CODES = new Set(['ASK_CANCELLED', 'ASK_ABORTED', 'NO_PROVIDER']);
|
|
17
17
|
|
|
18
18
|
function isValidPath(p) {
|
|
19
19
|
return (
|
|
@@ -52,6 +52,8 @@ const bootstrap = {
|
|
|
52
52
|
return `❓ 确认将以下路径作为项目根?\n${projectRoot}`;
|
|
53
53
|
case 'cancelled':
|
|
54
54
|
return '🚫 已取消';
|
|
55
|
+
case 'no_provider':
|
|
56
|
+
return '⚠️ 当前环境不支持交互式提问。请在 dsh-tui 中运行此命令,或确保 web UI 已正确加载交互组件。';
|
|
55
57
|
case 'initializing':
|
|
56
58
|
return `⏳ 正在初始化 ${projectRoot}...`;
|
|
57
59
|
case 'success':
|
|
@@ -88,6 +90,9 @@ export function apply(ctx) {
|
|
|
88
90
|
signal,
|
|
89
91
|
});
|
|
90
92
|
} catch (err) {
|
|
93
|
+
if (err?.code === 'NO_PROVIDER') {
|
|
94
|
+
return notify(session, 'error', bootstrap.notify({ type: 'no_provider' }));
|
|
95
|
+
}
|
|
91
96
|
if (err?.code && USER_CANCEL_CODES.has(err.code)) {
|
|
92
97
|
return notify(session, 'error', bootstrap.notify({ type: 'cancelled' }));
|
|
93
98
|
}
|
|
@@ -128,6 +133,9 @@ export function apply(ctx) {
|
|
|
128
133
|
signal,
|
|
129
134
|
});
|
|
130
135
|
} catch (err) {
|
|
136
|
+
if (err?.code === 'NO_PROVIDER') {
|
|
137
|
+
return notify(session, 'error', bootstrap.notify({ type: 'no_provider' }));
|
|
138
|
+
}
|
|
131
139
|
if (err?.code && USER_CANCEL_CODES.has(err.code)) {
|
|
132
140
|
return notify(session, 'error', bootstrap.notify({ type: 'cancelled' }));
|
|
133
141
|
}
|
package/commands/scan/index.js
CHANGED
|
@@ -14,8 +14,8 @@ import * as fanqie from './platforms/fanqie.js';
|
|
|
14
14
|
import * as jinjiang from './platforms/jinjiang.js';
|
|
15
15
|
import * as qimao from './platforms/qimao.js';
|
|
16
16
|
|
|
17
|
-
/** UserQuestionError codes that indicate user cancellation */
|
|
18
|
-
const USER_CANCEL_CODES = new Set(['ASK_CANCELLED', 'ASK_ABORTED']);
|
|
17
|
+
/** UserQuestionError codes that indicate user cancellation or unavailability */
|
|
18
|
+
const USER_CANCEL_CODES = new Set(['ASK_CANCELLED', 'ASK_ABORTED', 'NO_PROVIDER']);
|
|
19
19
|
|
|
20
20
|
// inject is declared in the root index.js; only apply() is imported by index.js
|
|
21
21
|
|
|
@@ -69,6 +69,8 @@ const scan = {
|
|
|
69
69
|
return '❌ 无效选择,请输入 1-4 的编号。';
|
|
70
70
|
case 'cancelled':
|
|
71
71
|
return '🚫 已取消。';
|
|
72
|
+
case 'no_provider':
|
|
73
|
+
return '⚠️ 当前环境不支持交互式提问。请在 dsh-tui 中运行此命令,或确保 web UI 已正确加载交互组件。';
|
|
72
74
|
case 'handover':
|
|
73
75
|
return (
|
|
74
76
|
`📊 采集完成,正在将数据交给 LLM 进行分析...\n` +
|
|
@@ -148,7 +150,10 @@ export function apply(ctx) {
|
|
|
148
150
|
signal,
|
|
149
151
|
});
|
|
150
152
|
} catch (err) {
|
|
151
|
-
// Handle user cancellation
|
|
153
|
+
// Handle user cancellation or no provider
|
|
154
|
+
if (err?.code === 'NO_PROVIDER') {
|
|
155
|
+
return notify(session, 'error', scan.notify({ type: 'no_provider' }));
|
|
156
|
+
}
|
|
152
157
|
if (err?.code && USER_CANCEL_CODES.has(err.code)) {
|
|
153
158
|
return notify(session, 'error', scan.notify({ type: 'cancelled' }));
|
|
154
159
|
}
|
|
@@ -175,6 +180,9 @@ export function apply(ctx) {
|
|
|
175
180
|
signal,
|
|
176
181
|
});
|
|
177
182
|
} catch (err) {
|
|
183
|
+
if (err?.code === 'NO_PROVIDER') {
|
|
184
|
+
return notify(session, 'error', scan.notify({ type: 'no_provider' }));
|
|
185
|
+
}
|
|
178
186
|
if (err?.code && USER_CANCEL_CODES.has(err.code)) {
|
|
179
187
|
return notify(session, 'error', scan.notify({ type: 'cancelled' }));
|
|
180
188
|
}
|