diff --git a/webui/Main.py b/webui/Main.py index 357ea45..22be7ab 100644 --- a/webui/Main.py +++ b/webui/Main.py @@ -57,6 +57,16 @@ i18n_dir = os.path.join(root_dir, "webui", "i18n") config_file = os.path.join(root_dir, "webui", ".streamlit", "webui.toml") system_locale = utils.get_system_locale() + +if "video_subject" not in st.session_state: + st.session_state["video_subject"] = "" +if "video_script" not in st.session_state: + st.session_state["video_script"] = "" +if "video_terms" not in st.session_state: + st.session_state["video_terms"] = "" +if "ui_language" not in st.session_state: + st.session_state["ui_language"] = config.ui.get("language", system_locale) + # 加载语言文件 locales = utils.load_locales(i18n_dir) @@ -97,16 +107,6 @@ support_locales = [ "th-TH", ] -if "video_subject" not in st.session_state: - st.session_state["video_subject"] = "" -if "video_script" not in st.session_state: - st.session_state["video_script"] = "" -if "video_terms" not in st.session_state: - st.session_state["video_terms"] = "" -if "ui_language" not in st.session_state: - st.session_state["ui_language"] = config.ui.get("language", system_locale) - - def get_all_fonts(): fonts = [] for root, dirs, files in os.walk(font_dir):