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

Function load_prompt

social/scripts/common.py:216–248  ·  view source on GitHub ↗

Load a prompt file from social/prompts/{name}.md Automatically injects brand components: - {about} -> content from brand/about.md - {visual_style} -> content from brand/visual.md - {bee_character} -> content from brand/bee.md - {links} -> content from brand/links.md Args:

(name: str)

Source from the content-addressed store, hash-verified

214
215
216def load_prompt(name: str) -> str:
217 """Load a prompt file from social/prompts/{name}.md
218
219 Automatically injects brand components:
220 - {about} -> content from brand/about.md
221 - {visual_style} -> content from brand/visual.md
222 - {bee_character} -> content from brand/bee.md
223 - {links} -> content from brand/links.md
224
225 Args:
226 name: 'tone/twitter', 'gist', 'highlights', etc.
227
228 Returns:
229 The prompt content as a string with brand components injected
230 """
231 prompt_path = PROMPTS_DIR / f"{name}.md"
232
233 if not prompt_path.exists():
234 print(f"Warning: Prompt file not found: {prompt_path}")
235 return ""
236
237 with open(prompt_path, "r", encoding="utf-8") as f:
238 content = f.read()
239
240 # Remove the markdown title (first line starting with #)
241 lines = content.split("\n")
242 if lines and lines[0].startswith("#"):
243 content = "\n".join(lines[1:]).strip()
244
245 # Inject brand prompt components
246 content = _inject_shared_prompts(content)
247
248 return content
249
250
251def load_format(platform: str) -> str:

Callers 10

mainFunction · 0.90
_weekly_image_contextFunction · 0.90
generate_digestFunction · 0.90
generate_discord_postFunction · 0.90
create_highlights_promptFunction · 0.90
generate_summaryFunction · 0.90
render_ai_reportFunction · 0.90
analyze_prFunction · 0.90
load_formatFunction · 0.85
generate_platform_postFunction · 0.85

Calls 1

_inject_shared_promptsFunction · 0.85

Tested by

no test coverage detected