From 8dae239185edf3f8328cfd6e4a757896f90e253f Mon Sep 17 00:00:00 2001 From: Hawk Lee Date: Mon, 16 Feb 2026 10:09:25 +0800 Subject: [PATCH] feat: Splitter embeds emotion tags into output text When Emotion Annotator has tagged dialogue with emotions, Splitter now outputs '[Happy] text...' format in speaker_A_text and speaker_B_text, so downstream TTS nodes can consume them. Also passes emotion field through in split_map. --- aiia_podcast_splitter.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/aiia_podcast_splitter.py b/aiia_podcast_splitter.py index 996b2c9..6835389 100644 --- a/aiia_podcast_splitter.py +++ b/aiia_podcast_splitter.py @@ -78,6 +78,11 @@ class AIIA_Podcast_Splitter: text = item["text"] speaker = item["speaker"] + emotion = item.get("emotion") + + # 如果有情感标签(来自 Emotion Annotator),嵌入到文本中 + # 格式: [Happy] 台词... (CosyVoice 原生支持此格式) + output_text = f"[{emotion}] {text}" if emotion else text if speaker == speaker_A: split_map.append({ @@ -86,8 +91,9 @@ class AIIA_Podcast_Splitter: "index": len(texts_A), "text": text, "original_speaker": speaker, + "emotion": emotion, }) - texts_A.append(text) + texts_A.append(output_text) elif speaker == speaker_B: split_map.append({ "type": "speech", @@ -95,8 +101,9 @@ class AIIA_Podcast_Splitter: "index": len(texts_B), "text": text, "original_speaker": speaker, + "emotion": emotion, }) - texts_B.append(text) + texts_B.append(output_text) else: print(f"{log} 跳过第三个说话人 '{speaker}' 的台词: {text[:30]}...")