MCPcopy Create free account
hub / github.com/pollinations/pollinations / load_format

Function load_format

social/scripts/common.py:251–281  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

249
250
251def 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
284def call_pollinations_api(

Callers 3

mainFunction · 0.90
generate_discord_postFunction · 0.90
generate_platform_postFunction · 0.85

Calls 2

load_promptFunction · 0.85
appendMethod · 0.65

Tested by

no test coverage detected