feat: TTS 服务功能完善(任务管理、配置优化、客户端实现)
This commit is contained in:
@@ -12,11 +12,19 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
class TtsTaskServiceTest {
|
||||
|
||||
@Test
|
||||
@DisplayName("cleanText strips markdown and normalizes whitespace")
|
||||
void cleanTextStripsMarkdownAndNormalizesWhitespace() {
|
||||
String cleaned = TtsTaskServiceImpl.cleanText("# Title\n\n> **hello** `world` - ok");
|
||||
@DisplayName("cleanText strips markdown but keeps Chinese narration rhythm")
|
||||
void cleanTextStripsMarkdownButKeepsChineseNarrationRhythm() {
|
||||
String cleaned = TtsTaskServiceImpl.cleanText("# 第一章\n\n> **她 终于** 看见了自己\n\n- 转身离开");
|
||||
|
||||
assertEquals("Title hello world ok", cleaned);
|
||||
assertEquals("第一章。\n\n她终于看见了自己。\n\n转身离开。", cleaned);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("cleanText preserves sentence punctuation for natural pauses")
|
||||
void cleanTextPreservesSentencePunctuationForNaturalPauses() {
|
||||
String cleaned = TtsTaskServiceImpl.cleanText("他说: 这一次,我想自己选择!\n\n你听见了吗?");
|
||||
|
||||
assertEquals("他说:这一次,我想自己选择!\n\n你听见了吗?", cleaned);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -28,6 +36,9 @@ class TtsTaskServiceTest {
|
||||
@Test
|
||||
@DisplayName("TtsEngineResult exposes synthesis result fields")
|
||||
void ttsEngineResultExposesFields() {
|
||||
TtsEngineClient.SynthesisOptions options = new TtsEngineClient.SynthesisOptions(0.92D, 0D, "story");
|
||||
assertEquals("rate=0.92;pitch=0.0;emotion=story", options.cacheKey());
|
||||
|
||||
TtsEngineClient.TtsEngineResult result =
|
||||
new TtsEngineClient.TtsEngineResult(true, "/tmp/a.mp3", 1200L, null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user