cortico-world-fish-sing 0.4.6 → 0.4.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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/);版本号遵循语义化。
4
4
 
5
+ ## [0.4.7] - 2026-11-02
6
+
7
+ ### 新增
8
+ - **「测试通知」按钮**:训练页工具栏点一下立刻发一条测试通知,看它落在哪个渠道(QQ / 桌宠),不用等下一次训练结束才知道 QQ 通不通。
9
+
10
+ ### 修复
11
+ - 文本通知的 OneBot 超时从 120 秒收紧到 **15 秒**:SnowLuma 端口开着但不响应时,不会再让「训练完成」等两分钟才退桌宠(发语音条仍是 120 秒,mp3→SILK 转换本来就慢)。
12
+
5
13
  ## [0.4.6] - 2026-11-02
6
14
 
7
15
  ### 修复
@@ -722,7 +722,9 @@ function mountTrain(ctx) {
722
722
  const pathIn = el('input', 'fs-tpath');
723
723
  pathIn.placeholder = '粘贴素材文件夹或单个文件路径,可多个用 ; 分隔';
724
724
  const scanBtn = el('button', 'fs-btn', '扫描');
725
- bar.append(pathIn, scanBtn);
725
+ const notifyTest = el('button', 'fs-btn', '测试通知');
726
+ notifyTest.title = '立刻发一条测试通知:QQ 通就发 QQ,不通就退桌宠——点了就知道渠道状态';
727
+ bar.append(pathIn, scanBtn, notifyTest);
726
728
 
727
729
  const dsBar = el('div', 'fs-bar');
728
730
  const dsSel = el('select', 'fs-btn');
@@ -1512,6 +1514,20 @@ function mountTrain(ctx) {
1512
1514
  appendLabel.textContent = appendChk.checked ? '追加到当前数据集' : '新建数据集';
1513
1515
  });
1514
1516
 
1517
+ notifyTest.addEventListener('click', async () => {
1518
+ notifyTest.disabled = true;
1519
+ notifyTest.textContent = '发送中…';
1520
+ try {
1521
+ const r = await ctx.invoke('trainNotifyTest');
1522
+ say((r && r.note) ? `通知:${r.note}${r.via ? `(${r.via})` : ''}` : '通知已发');
1523
+ } catch (e) {
1524
+ say(`测试通知失败:${(e && e.message) || e}`, true);
1525
+ } finally {
1526
+ notifyTest.disabled = false;
1527
+ notifyTest.textContent = '测试通知';
1528
+ }
1529
+ });
1530
+
1515
1531
  scanBtn.addEventListener('click', async () => {
1516
1532
  const raw = String(pathIn.value || '').trim();
1517
1533
  if (!raw) {
package/dist/webui.js CHANGED
@@ -722,7 +722,9 @@ function mountTrain(ctx) {
722
722
  const pathIn = el('input', 'fs-tpath');
723
723
  pathIn.placeholder = '粘贴素材文件夹或单个文件路径,可多个用 ; 分隔';
724
724
  const scanBtn = el('button', 'fs-btn', '扫描');
725
- bar.append(pathIn, scanBtn);
725
+ const notifyTest = el('button', 'fs-btn', '测试通知');
726
+ notifyTest.title = '立刻发一条测试通知:QQ 通就发 QQ,不通就退桌宠——点了就知道渠道状态';
727
+ bar.append(pathIn, scanBtn, notifyTest);
726
728
 
727
729
  const dsBar = el('div', 'fs-bar');
728
730
  const dsSel = el('select', 'fs-btn');
@@ -1512,6 +1514,20 @@ function mountTrain(ctx) {
1512
1514
  appendLabel.textContent = appendChk.checked ? '追加到当前数据集' : '新建数据集';
1513
1515
  });
1514
1516
 
1517
+ notifyTest.addEventListener('click', async () => {
1518
+ notifyTest.disabled = true;
1519
+ notifyTest.textContent = '发送中…';
1520
+ try {
1521
+ const r = await ctx.invoke('trainNotifyTest');
1522
+ say((r && r.note) ? `通知:${r.note}${r.via ? `(${r.via})` : ''}` : '通知已发');
1523
+ } catch (e) {
1524
+ say(`测试通知失败:${(e && e.message) || e}`, true);
1525
+ } finally {
1526
+ notifyTest.disabled = false;
1527
+ notifyTest.textContent = '测试通知';
1528
+ }
1529
+ });
1530
+
1515
1531
  scanBtn.addEventListener('click', async () => {
1516
1532
  const raw = String(pathIn.value || '').trim();
1517
1533
  if (!raw) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-fish-sing",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "让她真的开口唱:B 站点歌或本地文件 → 分离 → 换声 → 混音,本机出声或发 QQ 语音条",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -36,7 +36,7 @@
36
36
  "local"
37
37
  ],
38
38
  "describe": "describe.json",
39
- "webUiClient": "dist/webui-4d01e72b.js"
39
+ "webUiClient": "dist/webui-a1576ab5.js"
40
40
  },
41
41
  "scripts": {
42
42
  "doctor": "node tools/doctor.mjs"
package/src/deliver.ts CHANGED
@@ -99,7 +99,12 @@ export function parseTarget(to: string): OneBotTarget | null {
99
99
  : { action: 'send_private_msg', params: { user_id: id }, label: `私聊 ${id}` };
100
100
  }
101
101
 
102
- async function callOneBot(opts: OneBotOptions, action: string, params: Record<string, unknown>): Promise<void> {
102
+ async function callOneBot(
103
+ opts: OneBotOptions,
104
+ action: string,
105
+ params: Record<string, unknown>,
106
+ timeoutMs = 120_000,
107
+ ): Promise<void> {
103
108
  const res = await fetch(`${opts.httpUrl.replace(/\/+$/, '')}/${action}`, {
104
109
  method: 'POST',
105
110
  headers: {
@@ -107,7 +112,7 @@ async function callOneBot(opts: OneBotOptions, action: string, params: Record<st
107
112
  ...(opts.token ? { authorization: `Bearer ${opts.token}` } : {}),
108
113
  },
109
114
  body: JSON.stringify(params),
110
- signal: AbortSignal.timeout(120_000),
115
+ signal: AbortSignal.timeout(timeoutMs),
111
116
  });
112
117
  const body = (await res.json().catch(() => ({}))) as Record<string, unknown>;
113
118
  if (!res.ok) throw new Error(`OneBot HTTP ${res.status}`);
@@ -126,8 +131,12 @@ export async function sendRecord(opts: OneBotOptions, target: OneBotTarget, file
126
131
  }
127
132
 
128
133
  export async function sendText(opts: OneBotOptions, target: OneBotTarget, text: string): Promise<void> {
129
- await callOneBot(opts, target.action, {
130
- ...target.params,
131
- message: [{ type: 'text', data: { text } }],
132
- });
134
+ // 文本通知给短超时:SnowLuma 端口开着但不响应时,别让"训练完成"等两分钟才退桌宠。
135
+ // 语音条(sendRecord)仍用 120 秒——大文件 + mp3→SILK 转换本来就慢。
136
+ await callOneBot(
137
+ opts,
138
+ target.action,
139
+ { ...target.params, message: [{ type: 'text', data: { text } }] },
140
+ 15_000,
141
+ );
133
142
  }
package/src/world.ts CHANGED
@@ -1171,6 +1171,15 @@ export class FishSingWorld implements World {
1171
1171
  return { text: text || `没生成:${exp} 只找到一个可用存档(中间档可能已被清理)` };
1172
1172
  }
1173
1173
 
1174
+ if (method === 'trainNotifyTest') {
1175
+ // 「QQ 通不通」不用等下一次训练结束才知道:手动发一条,看落在哪个渠道。
1176
+ const out = (await this.notifyEvent(
1177
+ '测试通知(唱歌插件)',
1178
+ '这是一条测试消息:收到就说明通知渠道通了。',
1179
+ )) as { via?: string; note?: string };
1180
+ return { via: out?.via ?? '', note: out?.note ?? '' };
1181
+ }
1182
+
1174
1183
  if (method === 'trainStop') {
1175
1184
  await this.worker.cancel();
1176
1185
  if (this.trainJob?.state === 'running') {