(topic: str, content: str, output_format: str = None)
| 264 | return reference_figures |
| 265 | |
| 266 | def get_initial_prompt_template(topic: str, content: str, output_format: str = None) -> str: |
| 267 | if topic not in CONFIG['SUPPORTED_TOPICS']: |
| 268 | raise ValueError(f"Unsupported topic: {topic}. Supported topics are: {CONFIG['SUPPORTED_TOPICS']}") |
| 269 | |
| 270 | output_format = output_format or CONFIG.get('OUTPUT_FORMAT', 'svg') |
| 271 | |
| 272 | common_placeholder_spec = """ |
| 273 | **Placeholder Specification:** |
| 274 | * To prepare for final illustration, an icon needs a placeholder. |
| 275 | * **Function**: The placeholder's role is to reserve space and provide a clear directive for the illustrator. |
| 276 | * **Recommended Implementation**: A clean, professional way to do this is with a gray, rounded-corner rectangle (`<rect rx="8" ry="8" style="fill:#cccccc; stroke:#666666; stroke-width:1;" />`). |
| 277 | * **Content (CRITICAL)**: Each placeholder MUST contain two pieces of text: |
| 278 | * **Exterior Label**: A concise name for the component, placed **outside** the box (e.g., above it). |
| 279 | * **Interior Description**: A detailed English phrase describing the desired icon using the format `[icon]: <description>`, placed **inside** the box (e.g., `[icon]: An icon showing a robot meticulously reviewing a paper`). This description MUST NOT appear in the final illustration but is a crucial instruction and it must be detailed and concrete. |
| 280 | """ |
| 281 | |
| 282 | # Select appropriate prompt template based on output format |
| 283 | if output_format == 'mxgraphxml': |
| 284 | if topic == 'paper': |
| 285 | return _get_paper_mxgraphxml_prompt_template(content, common_placeholder_spec) |
| 286 | elif topic == 'survey': |
| 287 | return _get_survey_mxgraphxml_prompt_template(content, common_placeholder_spec) |
| 288 | elif topic == 'blog': |
| 289 | return _get_blog_mxgraphxml_prompt_template(content, common_placeholder_spec) |
| 290 | elif topic == 'textbook': |
| 291 | return _get_textbook_mxgraphxml_prompt_template(content, common_placeholder_spec) |
| 292 | else: # default to svg |
| 293 | if topic == 'paper': |
| 294 | return _get_paper_prompt_template(content, common_placeholder_spec) |
| 295 | elif topic == 'survey': |
| 296 | return _get_survey_prompt_template(content, common_placeholder_spec) |
| 297 | elif topic == 'blog': |
| 298 | return _get_blog_prompt_template(content, common_placeholder_spec) |
| 299 | elif topic == 'textbook': |
| 300 | return _get_textbook_prompt_template(content, common_placeholder_spec) |
| 301 | |
| 302 | def extract_layout_type(svg_code: str) -> Optional[str]: |
| 303 | try: |
no test coverage detected