支持固定脚本多种分割方式(段落/行/句子),修复Edge TTS和模板切换问题
This commit is contained in:
@@ -59,6 +59,23 @@ def render_content_input():
|
||||
help=text_help
|
||||
)
|
||||
|
||||
# Split mode selector (only show in fixed mode)
|
||||
if mode == "fixed":
|
||||
split_mode_options = {
|
||||
"paragraph": tr("split.mode_paragraph"),
|
||||
"line": tr("split.mode_line"),
|
||||
"sentence": tr("split.mode_sentence"),
|
||||
}
|
||||
split_mode = st.selectbox(
|
||||
tr("split.mode_label"),
|
||||
options=list(split_mode_options.keys()),
|
||||
format_func=lambda x: split_mode_options[x],
|
||||
index=0, # Default to paragraph mode
|
||||
help=tr("split.mode_help")
|
||||
)
|
||||
else:
|
||||
split_mode = "paragraph" # Default for generate mode (not used)
|
||||
|
||||
# Title input (optional for both modes)
|
||||
title = st.text_input(
|
||||
tr("input.title"),
|
||||
@@ -87,7 +104,8 @@ def render_content_input():
|
||||
"mode": mode,
|
||||
"text": text,
|
||||
"title": title,
|
||||
"n_scenes": n_scenes
|
||||
"n_scenes": n_scenes,
|
||||
"split_mode": split_mode
|
||||
}
|
||||
|
||||
else:
|
||||
|
||||
@@ -47,6 +47,7 @@ def render_single_output(pixelle_video, video_params):
|
||||
mode = video_params.get("mode", "generate")
|
||||
title = video_params.get("title")
|
||||
n_scenes = video_params.get("n_scenes", 5)
|
||||
split_mode = video_params.get("split_mode", "paragraph")
|
||||
bgm_path = video_params.get("bgm_path")
|
||||
bgm_volume = video_params.get("bgm_volume", 0.2)
|
||||
|
||||
@@ -129,6 +130,7 @@ def render_single_output(pixelle_video, video_params):
|
||||
"mode": mode,
|
||||
"title": title if title else None,
|
||||
"n_scenes": n_scenes,
|
||||
"split_mode": split_mode,
|
||||
"media_workflow": workflow_key,
|
||||
"frame_template": frame_template,
|
||||
"prompt_prefix": prompt_prefix,
|
||||
|
||||
@@ -345,6 +345,13 @@ def render_style_config(pixelle_video):
|
||||
if 'selected_template' not in st.session_state:
|
||||
st.session_state['selected_template'] = type_specific_default
|
||||
|
||||
# Track last selected template type to detect type changes
|
||||
last_template_type = st.session_state.get('last_template_type', None)
|
||||
if last_template_type != selected_template_type:
|
||||
# Template type changed, reset to type-specific default
|
||||
st.session_state['selected_template'] = type_specific_default
|
||||
st.session_state['last_template_type'] = selected_template_type
|
||||
|
||||
# Collect size groups and prepare tabs
|
||||
size_groups = []
|
||||
size_labels = []
|
||||
|
||||
@@ -20,9 +20,14 @@
|
||||
"input.topic_help": "Enter a topic, AI will generate content based on it",
|
||||
"input.text": "Text Input",
|
||||
"input.text_help_generate": "Enter topic or theme (AI will create narrations)",
|
||||
"input.text_help_fixed": "Enter complete narration script (used directly without modification, one narration per line)",
|
||||
"input.text_help_fixed": "Enter complete narration script (used directly without modification)",
|
||||
"split.mode_label": "Split Strategy",
|
||||
"split.mode_help": "Choose how to split the text into video segments",
|
||||
"split.mode_paragraph": "📄 By Paragraph (\\n\\n)",
|
||||
"split.mode_line": "📝 By Line (\\n)",
|
||||
"split.mode_sentence": "✂️ By Sentence (。.!?)",
|
||||
"input.content": "Content",
|
||||
"input.content_placeholder": "Used directly without modification, one narration per line\nExample:\nHello everyone, today I'll share three study tips\nThe first tip is focus training, meditate for 10 minutes daily\nThe second tip is active recall, review immediately after learning",
|
||||
"input.content_placeholder": "Used directly without modification (split by strategy below)\nExample:\nHello everyone, today I'll share three study tips.\n\nThe first tip is focus training, meditate for 10 minutes daily.\n\nThe second tip is active recall, review immediately after learning.",
|
||||
"input.content_help": "Provide your own content for video generation",
|
||||
"input.title": "Title (Optional)",
|
||||
"input.title_placeholder": "Video title (auto-generated if empty)",
|
||||
|
||||
@@ -20,9 +20,14 @@
|
||||
"input.topic_help": "输入一个主题,AI 将根据主题生成内容",
|
||||
"input.text": "文本输入",
|
||||
"input.text_help_generate": "输入主题或话题(AI 将创作旁白)",
|
||||
"input.text_help_fixed": "输入完整的旁白脚本(直接使用,不做改写,每行一个旁白)",
|
||||
"input.text_help_fixed": "输入完整的旁白脚本(直接使用,不做改写)",
|
||||
"split.mode_label": "分割方式",
|
||||
"split.mode_help": "选择如何将文本分割为视频片段",
|
||||
"split.mode_paragraph": "📄 按段落(\\n\\n)",
|
||||
"split.mode_line": "📝 按行(\\n)",
|
||||
"split.mode_sentence": "✂️ 按句号(。.!?)",
|
||||
"input.content": "内容",
|
||||
"input.content_placeholder": "直接使用,不做改写,每行一个旁白\n例如:\n大家好,今天跟你分享三个学习技巧\n第一个技巧是专注力训练,每天冥想10分钟\n第二个技巧是主动回忆,学完立即复述",
|
||||
"input.content_placeholder": "直接使用,不做改写(根据下方分割方式切分)\n例如:\n大家好,今天跟你分享三个学习技巧。\n\n第一个技巧是专注力训练,每天冥想10分钟。\n\n第二个技巧是主动回忆,学完立即复述。",
|
||||
"input.content_help": "提供您自己的内容用于视频生成",
|
||||
"input.title": "标题(可选)",
|
||||
"input.title_placeholder": "视频标题(留空则自动生成)",
|
||||
|
||||
Reference in New Issue
Block a user