pnpm start
pnpm compile:linux
#pnpm compile:macos
#pnpm compile:windows
pnpm compile:linux
# 运行二进制包
./tzfe-tts
TTS_PORT 启动端口默认 8901
TTS_AUTH_TOKEN 鉴权token (如设置为TestToken,调用接口时需在headers里添加Authorization字段)
curl -fsSL https://tts.tzmf.xyz/install.sh | sh
# 查看服务状态
systemctl status tzfe-tts
# 查看日志
tail -F /var/log/tzfe-tts/tzfe-tts.log
- ==
curl -fsSL https://tts.tzmf.xyz/uninstall.sh | sh
curl -fsSL https://tts.tzmf.xyz/logrotate.sh | sh
fetch('http://0.0.0.0:8901/v1/audio/speech', {
method: 'POST',
// headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ' + 'TestToken' },
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
model: 'zh-CN-shaanxi-XiaoniNeural',
input: '网关异常,请及时处理。',
voice: 'rate:0|pitch:0'
})
})
.then((response) => response.blob())
.then((blob) => {
const audioUrl = URL.createObjectURL(blob);
const audio = new Audio(audioUrl);
audio.play();
});