templates.json 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. [
  2. {
  3. "name": "智能推荐播报",
  4. "category": "洗衣机推荐",
  5. "description": "结合天气/时段/城市/人群热度自动生成洗衣机播报文案",
  6. "output_description": "整洁的多段落播报语音脚本",
  7. "call_method": "POST /api/templates/render -> { template_id: 'wash_recommend', parameters: {...} }",
  8. "input_variables": [
  9. {
  10. "name": "hour",
  11. "label": "当前小时",
  12. "description": "0-23 小时数,用于问候与时段判断",
  13. "data_type": "number",
  14. "required": true,
  15. "default": "12"
  16. },
  17. {
  18. "name": "season",
  19. "label": "季节",
  20. "description": "如 春季/夏季/秋季/冬季",
  21. "data_type": "string",
  22. "required": true,
  23. "default": "夏季"
  24. },
  25. {
  26. "name": "city",
  27. "label": "城市",
  28. "description": "播报所在城市,用于地域化文案",
  29. "data_type": "string",
  30. "required": false,
  31. "default": "北京"
  32. },
  33. {
  34. "name": "program_name",
  35. "label": "洗衣程序",
  36. "description": "如 快速洗 / 强力洗 / 羊毛洗",
  37. "data_type": "string",
  38. "required": true,
  39. "default": "快速洗"
  40. },
  41. {
  42. "name": "feature_name",
  43. "label": "衣物特征",
  44. "description": "如 日常衣物 / 婴儿衣物 / 羽绒服",
  45. "data_type": "string",
  46. "required": false,
  47. "default": "日常衣物"
  48. },
  49. {
  50. "name": "temperature",
  51. "label": "气温",
  52. "description": "摄氏度,用于冷热判断",
  53. "data_type": "number",
  54. "required": false,
  55. "default": ""
  56. },
  57. {
  58. "name": "weather",
  59. "label": "天气",
  60. "description": "用于雨天等场景提示",
  61. "data_type": "string",
  62. "required": false,
  63. "default": ""
  64. },
  65. {
  66. "name": "user_count",
  67. "label": "使用用户数",
  68. "description": "用于展示热度,整数",
  69. "data_type": "number",
  70. "required": false,
  71. "default": ""
  72. },
  73. {
  74. "name": "user_proportion",
  75. "label": "用户占比",
  76. "description": "0-1 浮点数,转换百分比展示",
  77. "data_type": "number",
  78. "required": false,
  79. "default": ""
  80. }
  81. ],
  82. "template_body": "{%- set greeting = '亲爱的用户' if hour < 11 else '中午好' if hour < 14 else '下午好' if hour < 18 else '晚上好' -%}\n{%- set period = '早晨' if hour < 9 else '上午' if hour < 12 else '中午' if hour < 14 else '下午' if hour < 18 else '晚上' -%}\n\n{%- set is_hot = temperature is defined and temperature >= 30 -%}\n{%- set is_cold = temperature is defined and temperature <= 10 -%}\n{%- set has_rain = weather is defined and weather is string and '雨' in weather -%}\n{%- set condition = \n '炎热' if is_hot else \n '寒冷' if is_cold else \n '下雨' if has_rain else \n weather|default('美好') -%}\n\n{%- set proportion_pct = (user_proportion * 100)|round(1) if user_proportion is defined and user_proportion is not none else none -%}\n{%- set popularity_level = \n '最受欢迎' if proportion_pct is defined and proportion_pct is not none and proportion_pct >= 70 else \n '人气很高' if proportion_pct is defined and proportion_pct is not none and proportion_pct >= 50 else \n '很多人选择' if proportion_pct is defined and proportion_pct is not none and proportion_pct >= 30 else \n '值得一试' -%}\n\n{%- set user_desc = \n '超过' ~ user_count ~ '位用户' if user_count is defined and user_count is not none and user_count >= 10000 else \n user_count ~ '位用户' if user_count is defined and user_count is not none else \n '很多用户' -%}\n\n{# 第一段:基础推荐 + 数据支撑 #}\n{{ greeting }},为你推荐{{ feature_name|default('这类衣物') }}的{{ program_name }}程序,\n{%- if user_count is defined or user_proportion is defined %}\n这可是你的老朋友了,数据显示在{{ season }}{{ city|default('本地') }}{{ period }},\n{{ user_desc }}{% if proportion_pct is defined and proportion_pct is not none %},占比高达{{ proportion_pct }}%{% endif %}都爱用它洗呢。\n{%- else %}\n非常适合当前季节和衣物类型。\n{%- endif %}\n\n{# 第二段:季节场景化推荐 #}\n{%- if season in ['夏季', '冬天'] or is_hot or is_cold or has_rain %}\n{{ season }}洗衣时,\n{%- if is_hot %}高温天气下,{% elif is_cold %}寒冷天气下,{% elif has_rain %}雨天,{% endif %}\n{{ feature_name|default('这类衣物') }}的{{ program_name }}程序最懂你心意,\n{%- if proportion_pct is defined and proportion_pct is not none %}\n{{ city|default('本地') }}{{ period }}时段有{{ proportion_pct }}%用户选择它呢。\n{%- else %}\n很适合现在使用。\n{%- endif %}\n{%- endif %}\n\n{# 第三段:助手提醒(总是输出,增强亲切感) #}\n洗衣助手提醒你,{{ feature_name|default('这类衣物') }}的{{ program_name }}程序真不错,\n{%- if proportion_pct is defined and proportion_pct is not none %}\n{{ city|default('本地') }}{{ period }}时段人气也很旺,属于{{ popularity_level }}的洗衣方案。\n{%- else %}\n非常实用,值得一试。\n{%- endif %}\n\n{# 第四段:天气+时段氛围感推荐 #}\n又是一个{{ season }}{{ condition }}的{{ period }},\n为你推荐{{ feature_name|default('这类衣物') }}的{{ program_name }}程序,\n{%- if proportion_pct is defined and proportion_pct is not none %}\n这是{{ popularity_level }}的洗衣方案之一,{{ city|default('本地') }}{{ proportion_pct }}%用户都在用。\n{%- else %}\n这是当前最合适的洗涤方式。\n{%- endif %}\n\n{# 结尾温柔提醒 #}\n祝你洗衣愉快,衣物干净如新!",
  83. "id": "wash_recommend",
  84. "created_at": "2024-01-01T00:00:00Z",
  85. "updated_at": "2024-01-01T00:00:00Z"
  86. },
  87. {
  88. "name": "test",
  89. "category": "test",
  90. "description": "d",
  91. "output_description": "d",
  92. "call_method": "POST /api/templates/render\nContent-Type: application/json\n\n{\n \"template_id\": \"909602bd1c114ab3ae71d076920519bb\",\n \"parameters\": {\n \"tt\": \"tt\"\n }\n}",
  93. "input_variables": [
  94. {
  95. "name": "tt",
  96. "label": "tt",
  97. "description": "",
  98. "data_type": "string",
  99. "required": false,
  100. "default": "tt"
  101. }
  102. ],
  103. "template_body": "你好{{tt}}",
  104. "id": "909602bd1c114ab3ae71d076920519bb",
  105. "created_at": "2026-01-04T08:55:41.262950",
  106. "updated_at": "2026-01-04T08:55:43.871307"
  107. },
  108. {
  109. "name": "新模板",
  110. "category": "测试",
  111. "description": "d",
  112. "output_description": "d",
  113. "call_method": "POST /api/templates/render\nContent-Type: application/json\n\n{\n \"template_id\": \"<template-id>\",\n \"parameters\": {\n \"hello\": \"dd\"\n }\n}",
  114. "input_variables": [
  115. {
  116. "name": "hello",
  117. "label": "hello",
  118. "description": "",
  119. "data_type": "string",
  120. "required": false,
  121. "default": "hello"
  122. }
  123. ],
  124. "template_body": "你好{{hello}}",
  125. "id": "2fcf086c10eb4d43bdb9ae6c235e7a40",
  126. "created_at": "2026-01-04T09:00:24.557322",
  127. "updated_at": "2026-01-04T09:00:24.557325"
  128. }
  129. ]