@@ -730,8 +730,16 @@ async def _prepare_render_data(
730730 }
731731 )
732732
733+ # 通用模板上下文,包含可能被子模板引用的全局配置
734+ common_context = {
735+ "t2i_font_source" : self .config_manager .get_t2i_font_source (),
736+ "t2i_google_fonts_mirror" : self .config_manager .get_t2i_google_fonts_mirror (),
737+ "t2i_gstatic_mirror" : self .config_manager .get_t2i_gstatic_mirror (),
738+ "t2i_atri_font_mirror" : self .config_manager .get_t2i_atri_font_mirror (),
739+ }
740+
733741 topics_html = self .html_templates .render_template (
734- "topic_item.html" , topics = topics_list
742+ "topic_item.html" , topics = topics_list , ** common_context
735743 )
736744 logger .info (f"话题HTML生成完成,长度: { len (topics_html )} " )
737745
@@ -766,7 +774,7 @@ async def _prepare_render_data(
766774 titles_list .append (title_data )
767775
768776 titles_html = self .html_templates .render_template (
769- "user_title_item.html" , titles = titles_list
777+ "user_title_item.html" , titles = titles_list , ** common_context
770778 )
771779 logger .info (f"用户称号HTML生成完成,长度: { len (titles_html )} " )
772780
@@ -813,7 +821,7 @@ async def _prepare_render_data(
813821 )
814822
815823 quotes_html = self .html_templates .render_template (
816- "quote_item.html" , quotes = quotes_list
824+ "quote_item.html" , quotes = quotes_list , ** common_context
817825 )
818826 logger .info (f"金句HTML生成完成,长度: { len (quotes_html )} " )
819827
@@ -822,7 +830,7 @@ async def _prepare_render_data(
822830 activity_viz .hourly_activity
823831 )
824832 hourly_chart_html = self .html_templates .render_template (
825- chart_template , chart_data = chart_data
833+ chart_template , chart_data = chart_data , ** common_context
826834 )
827835 logger .info (f"活跃度图表HTML生成完成,长度: { len (hourly_chart_html )} " )
828836
@@ -853,7 +861,7 @@ async def _prepare_render_data(
853861 review_data = chat_quality_review
854862
855863 chat_quality_html = self .html_templates .render_template (
856- "chat_quality_item.html" , ** review_data
864+ "chat_quality_item.html" , ** review_data , ** common_context
857865 )
858866 logger .info (f"聊天质量锐评HTML生成完成,长度: { len (chat_quality_html )} " )
859867
0 commit comments