Initial commit: prompt template manager
React + Tailwind frontend, FastAPI backend, settings.json storage. Supports preset CRUD, live variable filling, and AI rewrite via OpenAI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import re
|
||||
|
||||
VAR_RE = re.compile(r'\{\{([a-zA-Z_][a-zA-Z0-9_]*)\}\}')
|
||||
|
||||
|
||||
def extract_vars(template: str) -> list[str]:
|
||||
seen = set()
|
||||
result = []
|
||||
for m in VAR_RE.finditer(template):
|
||||
if m.group(1) not in seen:
|
||||
seen.add(m.group(1))
|
||||
result.append(m.group(1))
|
||||
return result
|
||||
Reference in New Issue
Block a user