@oxiaom/adoremix 1.0.44 → 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.44",
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
  };
@@ -170,24 +170,19 @@ 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
+ 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';
191
186
  return null;
192
187
  }
193
188
 
@@ -280,6 +275,24 @@ function install(opts) {
280
275
  return 1;
281
276
  }
282
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
+
283
296
  // git clone
284
297
  try {
285
298
  logger.log('=== 克隆 Audio8_TTS 仓库 ===');