MCPcopy Create free account
hub / github.com/CopilotKit/OpenGenerativeUI / _load_seed_html

Function _load_seed_html

apps/agent/src/templates.py:53–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

51# If the file isn't available (e.g. in a standalone agent deploy), seeds will
52# still be discoverable by name but with empty HTML — the agent can regenerate.
53def _load_seed_html() -> None:
54 from pathlib import Path
55
56 seed_file = Path(__file__).resolve().parents[2] / "app" / "src" / "components" / "template-library" / "seed-templates.ts"
57 if not seed_file.exists():
58 return
59 text = seed_file.read_text()
60 # Map TS variable names to seed IDs
61 mapping = {
62 "weatherHtml": "seed-weather-001",
63 "invoiceHtml": "seed-invoice-001",
64 "dashboardHtml": "seed-dashboard-001",
65 }
66 for var_name, seed_id in mapping.items():
67 # Extract template literal content between first ` and last `
68 marker = f"const {var_name} = `"
69 start = text.find(marker)
70 if start == -1:
71 continue
72 start += len(marker)
73 end = text.find("`;", start)
74 if end == -1:
75 continue
76 html = text[start:end]
77 for seed in SEED_TEMPLATES:
78 if seed["id"] == seed_id:
79 seed["html"] = html
80 break
81
82_load_seed_html()
83

Callers 1

templates.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected