Load the ## {platform} section from prompts/format.md. Args: platform: 'Twitter', 'LinkedIn', 'Instagram', 'Reddit', 'Discord', 'Realtime' Returns: The section content (without the ## heading)
(platform: str)
| 249 | |
| 250 | |
| 251 | def load_format(platform: str) -> str: |
| 252 | """Load the ## {platform} section from prompts/format.md. |
| 253 | |
| 254 | Args: |
| 255 | platform: 'Twitter', 'LinkedIn', 'Instagram', 'Reddit', 'Discord', 'Realtime' |
| 256 | |
| 257 | Returns: |
| 258 | The section content (without the ## heading) |
| 259 | """ |
| 260 | content = load_prompt("format") |
| 261 | if not content: |
| 262 | return "" |
| 263 | |
| 264 | lines = content.split("\n") |
| 265 | section_lines = [] |
| 266 | in_section = False |
| 267 | |
| 268 | for line in lines: |
| 269 | if line.startswith("## "): |
| 270 | if in_section: |
| 271 | break |
| 272 | if line[3:].strip().lower() == platform.lower(): |
| 273 | in_section = True |
| 274 | continue |
| 275 | elif in_section: |
| 276 | section_lines.append(line) |
| 277 | |
| 278 | if not section_lines: |
| 279 | print(f"Warning: No ## {platform} section found in format.md") |
| 280 | |
| 281 | return "\n".join(section_lines).strip() |
| 282 | |
| 283 | |
| 284 | def call_pollinations_api( |
no test coverage detected