获取生成模板列表
获取当前已上架的生图、生视频模板。模板中的正向和负向提示词可用于提交用户自定义生图或生视频任务。
请求URL:
/getGenerateTemplateList
请求方式:
- POST
header:
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| Authorization | 是 | string | 授权Token,格式:Bearer {token} |
参数:
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| appId | 是 | string | App唯一标识 |
| udid | 是 | string | 唯一设备ID |
| type | 否 | uint8 | 模板类型:0-全部;1-生图;2-生视频,默认0 |
请求示例:
{
"appId": "com.example.app",
"udid": "device-uuid",
"type": 0
}
返回示例:
{
"code": 200,
"msg": "SUCCESS",
"data": {
"list": [
{
"id": 1,
"title": "电影感写真",
"description": "生成电影质感的人像图片",
"coverImg": "https://cdn.example.com/template/cinematic.jpg",
"video": "",
"cost": 4,
"positivePrompt": "cinematic portrait, dramatic lighting",
"negativePrompt": "low quality, blurry",
"type": 1
},
{
"id": 2,
"title": "动态运镜",
"description": "生成带有动态运镜的视频",
"coverImg": "https://cdn.example.com/template/camera-motion.jpg",
"video": "https://cdn.example.com/template/camera-motion.mp4",
"cost": 12,
"positivePrompt": "smooth camera movement",
"negativePrompt": "shaky, distorted",
"type": 2
}
]
}
}
返回参数说明:
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | int | 状态码 |
| msg | string | 提示信息 |
| data | struct | 返回数据 |
| - list | array | 模板列表;无数据时为空数组 |
| -- id | uint | 模板ID,提交生成任务时作为 templateId |
| -- title | string | 模板标题 |
| -- description | string | 模板描述 |
| -- coverImg | string | 模板封面图完整地址;S3相对路径由后台自动补全域名,未配置时为空字符串 |
| -- video | string | 模板预览视频完整地址;S3相对路径由后台自动补全域名,未配置时为空字符串 |
| -- cost | uint | 模板标示的消耗钻石数 |
| -- positivePrompt | string | 正面提示词;未配置时为空字符串 |
| -- negativePrompt | string | 负面提示词;未配置时为空字符串 |
| -- type | uint8 | 模板类型:1-生图;2-生视频 |
备注:
普通用户仅返回 state=1 的已上架模板,测试用户额外返回 state=2 的测试模板。结果按 sort、id 升序排列。后台管理字段不下发。
选择模板后,将模板 id 作为 templateId 传给 /submitGenerateMedia。后台会使用对应模板的 positivePrompt 作为任务正向提示词。
错误码:
- 510 系统异常
- 670 登录失效
- 800 参数错误