This commit is contained in:
949036910@qq.com
2026-05-29 23:16:52 +08:00
parent 7af1a17a5b
commit d9c4e04d66
3 changed files with 346 additions and 11 deletions

View File

@@ -0,0 +1,32 @@
"use strict";
/**
* 音色一键复刻(对齐 Electron ipc aliyun:cosyvoice:enroll
*/
const fs = require("fs");
const pipelineNative = require("./pipeline_native.js");
const desktopConfig = require("./desktop_config.js");
globalThis.__nodejsMain = async function main(params) {
const p = params || {};
const audioPath = String(p.audioPath || "").trim();
const name = String(p.name || "").trim();
if (!audioPath || !fs.existsSync(audioPath)) {
return { success: false, error: "请先录制或上传参考声音" };
}
if (!name) {
return { success: false, error: "请先输入音色名称" };
}
const apiKey =
desktopConfig.get("BAILIAN_API_KEY") ||
desktopConfig.get("DASHSCOPE_API_KEY");
if (!apiKey) {
return {
success: false,
error: "缺少 BAILIAN_API_KEY或 DASHSCOPE_API_KEY请在配置中设置",
};
}
return pipelineNative.qwenVoiceEnroll({ apiKey, audioPath, name });
};