# 模板展示

# 协议类型

消息类型 名称 必须实现
directive static_template 是
playing_template 是

# context

"unios_context": {
  ...
  "template": {
    "version": "1.0",
    "focused": true,
    "template_type": "IT-DEFAULT"
  },
  ...
}
1
2
3
4
5
6
7
8
9
参数 类型 说明 必填
version String 模块版本,现在是1.0 是
focused Bool 当前视觉焦点是否在template上,true代表当前焦点在template上 是
template_type String 当前获取视觉焦点的template的类型,可取值:IT-DEFAULT,LH-DEFAULT,WEB-DEFAULT,FAQ-RES-DEFAULT,FAQ-WEB-DEFAULT 否

# directive

静态模板(static_template)
静态模板的逻辑比较简单,收到即展示,与设备的其他模块没有任何关联。UniOS 提供了以下几种静态模板。

type 说明
IT-DEFAULT 图文卡片控件模板
LH-DEFAULT 列表控件模板
WEB-DEFAULT 网页控件模板
FAQ-RES-DEFAULT 智能问答类资源控件模板
FAQ-WEB-DEFAULT 智能问答类网页控件模板

IT-DEFAULT

图文卡片控件

回复示例

{
    "unios_directives": [
        {
            "header": {
                "name": "template.static_template"
            },
            ...
            "payload": {
                "type": "IT-DEFAULT",
                "templateId": "58dbb20412944dcca9e7c5d5d170e6f1",
                "subTitle": "柴油 6.79 元<br>89# 汽油 6.67 元<br>92#  汽油 7.13 元<br>95# 汽油 7.59  元",
                "provider": {
                    "name": "云知声",
                    "logoUrl": ""
                },
                "imageUrl": "http://dcs-resources-oss.hivoice.cn/skill/icon/oil.png",
                "linkUrl": "",
                "bgImageUrl": "",
                "title": "北京"
            }
        }
    ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
参数 类型 说明 必填
type String 模板类型,此处取值"IT-DEFAULT" 是
templateId String 该模板的id 是
bgImageUrl String 模板背景图片的url 否
title String 模板的主标题 是
subTitle String 模板的副标题 是
imageUrl String 图标的url 否
linkUrl String 链接url 否
provider Object 内容提供商 否
provider.name String 内容提供商名称 否
provider.logoUrl String 内容提供商logo地址 否

LH-DEFAULT
用于展示一个选项列表,仅支持点击选择和语音序号选择,选项被选择后需要发送请求至云端。

列表控件 回复示例

{
  "unios_directives": [
    ...,
    {
      "header": {
        "name": "template.static_template"
      },
      "payload": {
        "type": "LH-DEFAULT",
        "templateId": "xxxxx",
        "bgImageUrl": "xxxxxx",
        "items": [
          {
                "subTitle": "柴油 6.79 元<br>89# 汽油 6.67 元<br>92#  汽油 7.13 元<br>95# 汽油 7.59  元",
                "provider": {
                     "name": "云知声",
                     "logoUrl": ""
                },
                "imageUrl": "http://dcs-resources-oss.hivoice.cn/skill/icon/oil.png",
                "linkUrl": "",
                "bgImageUrl": "",
                "title": "北京",
                "elementId":"item唯一标识",
          },
          {
            ...
          }
        ]
      }
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
参数 类型 说明 必填
type String 模板类型,此处取值"LH-DEFAULT" 是
templateId String 该模板的id 是
bgImageUrl String 模板背景图片的url 否
items List 模板的列表项 是
items[i].elementId String item唯一标识 是
items[i].title String 模板的主标题 是
items[i].subTitle String 模板的副标题 是
items[i].imageUrl String 图标的url 否
items[i].linkUrl String 链接url 否
items[i].tag String 标签 否
items[i].provider Object 内容提供商 否
items[i].provider.name String 内容提供商名称 否
items[i].provider.logoUrl String 内容提供商logo地址 否

WEB-DEFAULT

列表控件

回复示例

{
  "unios_directives": [
    ...,
    {
      "header": {
        "name": "template.static_template"
      },
      "payload": {
        "type": "WEB-DEFAULT",
        "templateId": "xxxxx",
        "url": "http://xxx/unios-usk-crender/webhook/xz?astro=狮子座&date="
      }
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
参数 类型 说明 必填
type String 模板类型,此处取值"WEB-DEFAULT" 是
templateId String 该模板的id 是
url String 云端渲染的H5链接 否

FAQ-RES-DEFAULT
智能问答类文件资源展示模板

回复示例

{
  "unios_directives": [
    ...,
    {
      "header": {
        "name": "template.static_template"
      },
      "payload": {
        "type": "FAQ-RES-DEFAULT",
        "templateId": "xxxxx",
        "text": "北京烤鸭",
        "fileUrl": "http://dcs-resources-oss.hivoice.cn/skill/4PeEkrUjkapbleX9m-DOw5.png",
        "fileType": 1
      }
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

FAQ-WEB-DEFAULT
智能问答类网页展示模板

回复示例

{
  "unios_directives": [
    ...,
    {
      "header": {
        "name": "template.static_template"
      },
      "payload": {
        "type": "FAQ-WEB-DEFAULT",
        "templateId": "xxxxx",
        "text": "北京烤鸭",
        "webPageUrl": "https://baidu.com",
        "showType": 2,
        "linkTip": "更多"
      }
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

播放模板(playing_template)

播放模板主要用于展示设备播放的资源的信息。与静态模板不同,播放模板与设备其他的模块(如audio_player,playback_controller等)都有关联。

音频播放控件模板(VI-DEFAULT)

播报模板

回复示例

{
    "unios_directives": [
        {
            "header": {
                "name": "template.playing_template"
            },
            "payload": {
                "type": "VI-DEFAULT",
                "templateId": "xxxxx",
                "token": "2000037474",
                "title": "叠纸船的女孩",
                "subTitle": "",
                "author": "",
                "imageUrl": "http://dcs-resources-oss.hivoice.cn/audio/pic/214214.png",
                "bgImageUrl": "",
                "stream": {
                    "expiryTime": "",
                    "offset": "",
                    "duration": "",
                    "url": "http://10.20.222.143:8068/xxxx.mp3"
                },
                "lyric": {
                    "format": "",
                    "url": ""
                },
                "provider": {
                    "name": "贝瓦儿歌",
                    "logoUrl": ""
                }
            }
        }
    ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
参数 类型 说明 必填
type String 模板类型,此处取值"VI-DEFAULT" 是
templateId String 该模板的id 是
token String 资源ID 否
title String 模板的主标题 是
subTitle String 模板的副标题 是
imageUrl String 图标的url 否
bgImageUrl String 模板背景图片的url 否
stream Object 音频信息 否
stream.offset Long 播放进度 否
stream.duration Long 音频长度 否
stream.url String 播放链接 否
stream.expiryTime Long 过期时间 否
lyric Object 歌词信息 否
lyric.url String 歌词链接地址 否
lyric.format String 歌词格式 否
provider Object 内容提供商 否
provider.name String 内容提供商名称 否
provider.logoUrl String 内容提供商logo地址 否

视频播放控件模板(VD-DEFAULT)

播报模板

回复示例

{
    "unios_directives": [
        {
            "header": {
                "name": "template.playing_template"
            },
            "payload": {
                "type": "VD-DEFAULT",
                "templateId": "xxxxx",
                "token": "2000037474",
                "title": "叠纸船的女孩",
                "subTitle": "",
                "author": "",
                "imageUrl": "http://dcs-resources-oss.hivoice.cn/audio/pic/214214.png",
                "bgImageUrl": "",
                "stream": {
                    "expiryTime": "",
                    "offset": "",
                    "duration": "",
                    "url": "http://10.20.222.143:8068/xxxx.mp3"
                },
                "lyric": {
                    "format": "",
                    "url": ""
                },
                "provider": {
                    "name": "贝瓦儿歌",
                    "logoUrl": ""
                }
            }
        }
    ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
参数 类型 说明 必填
type String 模板类型,此处取值"VD-DEFAULT" 是
templateId String 该模板的id 是
token String 资源ID 否
title String 模板的主标题 是
subTitle String 模板的副标题 是
imageUrl String 图标的url 否
bgImageUrl String 模板背景图片的url 否
stream Object 音频信息 否
stream.offset Long 播放进度 否
stream.duration Long 音频长度 否
stream.url String 播放链接 否
stream.expiryTime Long 过期时间 否
lyric Object 歌词信息 否
lyric.url String 歌词链接地址 否
lyric.format String 歌词格式 否
provider Object 内容提供商 否
provider.name String 内容提供商名称 否
provider.logoUrl String 内容提供商logo地址 否