From b7e4744f28223d10c8661aef924c6985faee2781 Mon Sep 17 00:00:00 2001 From: binary-husky Date: Mon, 15 Jan 2024 11:49:04 +0800 Subject: [PATCH] apply to other themes --- themes/contrast.py | 10 ++++++++-- themes/gradios.py | 11 +++++++++-- themes/green.py | 10 ++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/themes/contrast.py b/themes/contrast.py index edaf154..9a4b56f 100644 --- a/themes/contrast.py +++ b/themes/contrast.py @@ -67,8 +67,14 @@ def adjust_theme(): button_cancel_text_color_dark="white", ) - with open(os.path.join(theme_dir, "common.js"), "r", encoding="utf8") as f: - js = f"" + js = "" + for jsf in [ + os.path.join(theme_dir, "common.js"), + os.path.join(theme_dir, "mermaid.min.js"), + os.path.join(theme_dir, "mermaid_loader.js"), + ]: + with open(jsf, "r", encoding="utf8") as f: + js += f"" # 添加一个萌萌的看板娘 if ADD_WAIFU: diff --git a/themes/gradios.py b/themes/gradios.py index 9c442e7..68f15df 100644 --- a/themes/gradios.py +++ b/themes/gradios.py @@ -31,8 +31,15 @@ def adjust_theme(): THEME = THEME.lstrip("huggingface-") set_theme = set_theme.from_hub(THEME.lower()) - with open(os.path.join(theme_dir, "common.js"), "r", encoding="utf8") as f: - js = f"" + js = "" + for jsf in [ + os.path.join(theme_dir, "common.js"), + os.path.join(theme_dir, "mermaid.min.js"), + os.path.join(theme_dir, "mermaid_loader.js"), + ]: + with open(jsf, "r", encoding="utf8") as f: + js += f"" + # 添加一个萌萌的看板娘 if ADD_WAIFU: diff --git a/themes/green.py b/themes/green.py index 34e4ba3..8428741 100644 --- a/themes/green.py +++ b/themes/green.py @@ -76,8 +76,14 @@ def adjust_theme(): chatbot_code_background_color_dark="*neutral_950", ) - with open(os.path.join(theme_dir, "common.js"), "r", encoding="utf8") as f: - js = f"" + js = "" + for jsf in [ + os.path.join(theme_dir, "common.js"), + os.path.join(theme_dir, "mermaid.min.js"), + os.path.join(theme_dir, "mermaid_loader.js"), + ]: + with open(jsf, "r", encoding="utf8") as f: + js += f"" # 添加一个萌萌的看板娘 if ADD_WAIFU: