INNER CODE UNIT · Python
oil_visual_reference_context
ChenShuo2004/cs-board · webapp/server.py:434
def oil_visual_reference_context(scenes: list[dict[str, Any]], infographic: bool = False) -> tuple[list[Path], str]:
scene = scenes[0] if scenes else {}
layout_type = str(scene.get("layout_type") or scene.get("visual_structure") or "focus")
text = " ".join(
str(item.get(key, ""))
for item in scenes
for key in ("title", "concept", "text", "key_text", "visual_strategy", "illustration_elements")
)
if layout_type == "comparison" or any(word in text for word in ("对比", "差异", "两种", "成本", "取舍")):
visual_mode, filename = "对比关系", "explainer-cost-comparison.png"
elif layout_type == "cycle" or any(word in text for word in ("循环", "反馈", "闭环")):
visual_mode, filename = "机制循环", "feedback-loop.png"
elif layout_type in {"path", "flow", "cause", "timeline"} or any(word in text for word in ("机制", "流程", "步骤", "瓶颈", "管线")):
visual_mode, filename = "机制流程", "pipeline-bottleneck.png"
elif any(word in text for word in ("人物", "角色", "讲解者", "陪伴", "团队", "主人公")):
visual_mode, filename = "角色场景", "transparent-illustration.png"
else:
visual_mode, filename = "概念解释", "from-complex-to-clear.png"