Load a brand prompt component from prompts/brand/{name}.md Args: name: 'about', 'visual', 'bee', 'links' Returns: The brand prompt content
(name: str)
| 149 | |
| 150 | |
| 151 | def load_shared(name: str) -> str: |
| 152 | """Load a brand prompt component from prompts/brand/{name}.md |
| 153 | |
| 154 | Args: |
| 155 | name: 'about', 'visual', 'bee', 'links' |
| 156 | |
| 157 | Returns: |
| 158 | The brand prompt content |
| 159 | """ |
| 160 | if name in _shared_prompts_cache: |
| 161 | return _shared_prompts_cache[name] |
| 162 | |
| 163 | shared_path = BRAND_DIR / f"{name}.md" |
| 164 | |
| 165 | if not shared_path.exists(): |
| 166 | print(f"Warning: Brand prompt not found: {shared_path}") |
| 167 | return "" |
| 168 | |
| 169 | with open(shared_path, "r", encoding="utf-8") as f: |
| 170 | content = f.read() |
| 171 | |
| 172 | # Remove markdown title and HTML comments |
| 173 | lines = content.split("\n") |
| 174 | filtered_lines = [] |
| 175 | for line in lines: |
| 176 | if line.startswith("#") and not filtered_lines: |
| 177 | continue # Skip first heading |
| 178 | if line.strip().startswith("<!--") and line.strip().endswith("-->"): |
| 179 | continue # Skip single-line HTML comments |
| 180 | filtered_lines.append(line) |
| 181 | |
| 182 | content = "\n".join(filtered_lines).strip() |
| 183 | _shared_prompts_cache[name] = content |
| 184 | return content |
| 185 | |
| 186 | |
| 187 | def _inject_shared_prompts(content: str) -> str: |
no test coverage detected