@oxiaom/adoremix 1.0.43 → 1.0.45

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": "@oxiaom/adoremix",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "description": "AdoreMix broadcast server - cross-platform installer, runner and service manager",
5
5
  "bin": {
6
6
  "adoremix": "./bin/adoremix.js"
@@ -105,6 +105,7 @@ module.exports = {
105
105
  minimax_token: '',
106
106
  edge_voice_override: '',
107
107
  audio8_base_url: 'http://127.0.0.1:8024',
108
- audio8_voice_override: ''
108
+ audio8_voice_override: '',
109
+ audio8_model_dir: ''
109
110
  }
110
111
  };
@@ -19,13 +19,14 @@
19
19
  * 声音克隆:3~10 秒参考音频,但需在 Audio8 服务端预设(请求时用 voice 参数指定)
20
20
  */
21
21
 
22
- const { execFileSync } = require('child_process');
22
+ const { execFileSync, execSync } = require('child_process');
23
23
  const fs = require('fs');
24
24
  const path = require('path');
25
25
  const os = require('os');
26
26
  const https = require('https');
27
27
  const http = require('http');
28
28
  const { URL } = require('url');
29
+ const logger = require('../../src/logger');
29
30
 
30
31
  // 中文常用 voice(Audio8 的 zh-CN voices,按性别分组)
31
32
  const VOICES = {
@@ -169,24 +170,19 @@ const AUDIO8_REQUIREMENTS = 'onnx_runtime/requirements.txt';
169
170
  const AUDIO8_SYSTEMD_NAME = 'audio8-tts';
170
171
  const AUDIO8_SYSTEMD_PATH = '/etc/systemd/system/audio8-tts.service';
171
172
  const AUDIO8_HEALTH_URL = `http://127.0.0.1:${AUDIO8_DEFAULT_PORT}/v1/models`;
173
+ // 自托管的预下载模型(可选,存到 ~/audio8_models/0.1B/ 下,避免每次 git clone 后再下 572MB)
174
+ const AUDIO8_MODEL_DIR = '~/audio8_models/audio8-TTS-0.1B-ONNX-INT8';
172
175
 
173
176
  // 包管理器嗅探(apt/dnf/yum/apk/pacman)
174
177
  function detectPkgMgr() {
175
- try {
176
- if (execFileSync('which apt-get', { stdio: 'pipe' }) && true) return 'apt';
177
- } catch (e) {}
178
- try {
179
- if (execFileSync('which dnf', { stdio: 'pipe' }) && true) return 'dnf';
180
- } catch (e) {}
181
- try {
182
- if (execFileSync('which yum', { stdio: 'pipe' }) && true) return 'yum';
183
- } catch (e) {}
184
- try {
185
- if (execFileSync('which apk', { stdio: 'pipe' }) && true) return 'apk';
186
- } catch (e) {}
187
- try {
188
- if (execFileSync('which pacman', { stdio: 'pipe' }) && true) return 'pacman';
189
- } catch (e) {}
178
+ function which(cmd) {
179
+ try { return execFileSync('command -v ' + cmd, { stdio: 'pipe', encoding: 'utf8' }).trim(); } catch (e) { return null; }
180
+ }
181
+ if (which('apt-get')) return 'apt';
182
+ if (which('dnf')) return 'dnf';
183
+ if (which('yum')) return 'yum';
184
+ if (which('apk')) return 'apk';
185
+ if (which('pacman')) return 'pacman';
190
186
  return null;
191
187
  }
192
188
 
@@ -279,6 +275,24 @@ function install(opts) {
279
275
  return 1;
280
276
  }
281
277
 
278
+ // 检查 config.ini 是否有预托管模型(audio8_model_dir)
279
+ let modelDir = '';
280
+ try {
281
+ const cfg = require(path.join(__dirname, '..', 'src', 'config'));
282
+ const wd = opts.workdir || process.env.ADOREMIX_WORKDIR || path.join(os.homedir(), '.local', 'share', 'adoremix');
283
+ modelDir = cfg.getConfigValue(wd, 'TTS.audio8_model_dir') || '';
284
+ } catch (e) {}
285
+ const modelLink = `~/audio8/onnx_runtime/model`; // Audio8 期望的相对路径
286
+ // 如果有预托管模型目录,建软链指向
287
+ if (modelDir) {
288
+ try {
289
+ logger.log('=== 链接预托管模型 ' + modelDir + ' → ' + modelLink + ' ===');
290
+ execSync(`mkdir -p $(dirname ${modelLink}) && rm -rf ${modelLink} && ln -s ${modelDir} ${modelLink}`, { stdio: 'inherit', shell: '/bin/bash' });
291
+ } catch (e) {
292
+ logger.warn('链接模型失败: ' + e.message);
293
+ }
294
+ }
295
+
282
296
  // git clone
283
297
  try {
284
298
  logger.log('=== 克隆 Audio8_TTS 仓库 ===');