WA template
This commit is contained in:
parent
7a2e21ba61
commit
d272ae0bd3
12 changed files with 1359 additions and 5 deletions
63
backend/app/agent_templates_seed.py
Normal file
63
backend/app/agent_templates_seed.py
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
from sqlalchemy import select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from .models import AgentMessageTemplate
|
||||
|
||||
DEFAULT_AGENT_TEMPLATES = [
|
||||
{
|
||||
"slug": "agent_run_completion",
|
||||
"name": "Agent Run Success",
|
||||
"description": (
|
||||
"Notify end users when an Urmi AI agent run completes, with a dynamic "
|
||||
"View Report button linking to the completion report."
|
||||
),
|
||||
"header_text": "Agent Run Complete",
|
||||
"body_preview": (
|
||||
"Hello {{customer_name}}, your agent run is complete, you can access "
|
||||
"the completion report at your URMI AI Portal."
|
||||
),
|
||||
"footer_text": "Thanks and regards, team - URMI AI",
|
||||
"meta_template_name": "agent_run_completion",
|
||||
"language": "en",
|
||||
"category": "utility",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "customer_name",
|
||||
"type": "string",
|
||||
"required": True,
|
||||
"description": "Recipient display name shown in the greeting",
|
||||
"example": "Suyash",
|
||||
},
|
||||
{
|
||||
"name": "report_id",
|
||||
"type": "string",
|
||||
"required": True,
|
||||
"description": "Unique report identifier appended to the View Report button URL",
|
||||
"example": "run-abc123",
|
||||
},
|
||||
],
|
||||
"button_label": "View Report",
|
||||
"button_url_base": "https://urmiai.com/reports/",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def seed_agent_message_templates(db: Session) -> None:
|
||||
for item in DEFAULT_AGENT_TEMPLATES:
|
||||
existing = db.scalar(select(AgentMessageTemplate).where(AgentMessageTemplate.slug == item["slug"]))
|
||||
if existing:
|
||||
existing.name = item["name"]
|
||||
existing.description = item["description"]
|
||||
existing.header_text = item["header_text"]
|
||||
existing.body_preview = item["body_preview"]
|
||||
existing.footer_text = item["footer_text"]
|
||||
existing.meta_template_name = item["meta_template_name"]
|
||||
existing.language = item["language"]
|
||||
existing.category = item["category"]
|
||||
existing.parameters = item["parameters"]
|
||||
existing.button_label = item["button_label"]
|
||||
existing.button_url_base = item["button_url_base"]
|
||||
existing.is_active = True
|
||||
else:
|
||||
db.add(AgentMessageTemplate(**item))
|
||||
db.commit()
|
||||
Loading…
Add table
Add a link
Reference in a new issue