@oxiaom/adoremix 1.0.44 → 1.0.46

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.44",
3
+ "version": "1.0.46",
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
  };
@@ -170,24 +170,24 @@ const AUDIO8_REQUIREMENTS = 'onnx_runtime/requirements.txt';
170
170
  const AUDIO8_SYSTEMD_NAME = 'audio8-tts';
171
171
  const AUDIO8_SYSTEMD_PATH = '/etc/systemd/system/audio8-tts.service';
172
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';
173
175
 
174
176
  // 包管理器嗅探(apt/dnf/yum/apk/pacman)
175
177
  function detectPkgMgr() {
176
- try {
177
- if (execFileSync('which apt-get', { stdio: 'pipe' }) && true) return 'apt';
178
- } catch (e) {}
179
- try {
180
- if (execFileSync('which dnf', { stdio: 'pipe' }) && true) return 'dnf';
181
- } catch (e) {}
182
- try {
183
- if (execFileSync('which yum', { stdio: 'pipe' }) && true) return 'yum';
184
- } catch (e) {}
185
- try {
186
- if (execFileSync('which apk', { stdio: 'pipe' }) && true) return 'apk';
187
- } catch (e) {}
188
- try {
189
- if (execFileSync('which pacman', { stdio: 'pipe' }) && true) return 'pacman';
190
- } catch (e) {}
178
+ function which(cmd) {
179
+ try { return execFileSync('command -v ' + cmd, { stdio: 'pipe', encoding: 'utf8' }).trim(); } catch (e) { return null; }
180
+ }
181
+ // 用 try/catch 区分 exit 0 vs 非 0(execFileSync 默认成功也抛错,绕过去)
182
+ function exists(cmd) {
183
+ try { execFileSync('command -v ' + cmd + ' >/dev/null 2>&1', { stdio: 'ignore' }); return true; }
184
+ catch (e) { return false; }
185
+ }
186
+ if (exists('apt-get')) return 'apt';
187
+ if (exists('dnf')) return 'dnf';
188
+ if (exists('yum')) return 'yum';
189
+ if (exists('apk')) return 'apk';
190
+ if (exists('pacman')) return 'pacman';
191
191
  return null;
192
192
  }
193
193
 
@@ -280,6 +280,24 @@ function install(opts) {
280
280
  return 1;
281
281
  }
282
282
 
283
+ // 检查 config.ini 是否有预托管模型(audio8_model_dir)
284
+ let modelDir = '';
285
+ try {
286
+ const cfg = require(path.join(__dirname, '..', 'src', 'config'));
287
+ const wd = opts.workdir || process.env.ADOREMIX_WORKDIR || path.join(os.homedir(), '.local', 'share', 'adoremix');
288
+ modelDir = cfg.getConfigValue(wd, 'TTS.audio8_model_dir') || '';
289
+ } catch (e) {}
290
+ const modelLink = `~/audio8/onnx_runtime/model`; // Audio8 期望的相对路径
291
+ // 如果有预托管模型目录,建软链指向
292
+ if (modelDir) {
293
+ try {
294
+ logger.log('=== 链接预托管模型 ' + modelDir + ' → ' + modelLink + ' ===');
295
+ execSync(`mkdir -p $(dirname ${modelLink}) && rm -rf ${modelLink} && ln -s ${modelDir} ${modelLink}`, { stdio: 'inherit', shell: '/bin/bash' });
296
+ } catch (e) {
297
+ logger.warn('链接模型失败: ' + e.message);
298
+ }
299
+ }
300
+
283
301
  // git clone
284
302
  try {
285
303
  logger.log('=== 克隆 Audio8_TTS 仓库 ===');