fix(uapi): data/response Jinja2 templates — transform bricks fields to MiniMax API format
This commit is contained in:
parent
f3725ba95e
commit
01e0187dba
@ -1,14 +1,20 @@
|
||||
-- ============================================================
|
||||
-- MiniMax-H3 — uapiio + uapi(bricks input_field 格式)
|
||||
-- MiniMax-H3 — uapiio + uapi (data/response Jinja2 templates)
|
||||
-- ============================================================
|
||||
|
||||
-- === uapiio ===
|
||||
-- input_fields: bricks兼容格式,数组,每个字段有 name/label/uitype
|
||||
INSERT IGNORE INTO uapiio (id, name, description, input_fields) VALUES (
|
||||
'm_h3_video_gen_io',
|
||||
'MiniMax-H3 视频生成',
|
||||
'MiniMax-H3 视频生成v2接口。支持文生视频、图生视频(首帧/尾帧)。',
|
||||
'[
|
||||
{
|
||||
"name": "model",
|
||||
"label": "模型",
|
||||
"uitype": "text",
|
||||
"defaultvalue": "MiniMax-H3",
|
||||
"hidden": true
|
||||
},
|
||||
{
|
||||
"name": "prompt",
|
||||
"label": "提示词",
|
||||
@ -16,7 +22,7 @@ INSERT IGNORE INTO uapiio (id, name, description, input_fields) VALUES (
|
||||
"uitype": "text"
|
||||
},
|
||||
{
|
||||
"name": "image_url",
|
||||
"name": "image_files",
|
||||
"label": "参考图片(首帧)",
|
||||
"uitype": "image"
|
||||
},
|
||||
@ -35,10 +41,13 @@ INSERT IGNORE INTO uapiio (id, name, description, input_fields) VALUES (
|
||||
"label": "视频时长",
|
||||
"uitype": "code",
|
||||
"data": [
|
||||
{"value": 4, "text": "4秒"},
|
||||
{"value": 5, "text": "5秒"},
|
||||
{"value": 6, "text": "6秒"},
|
||||
{"value": 8, "text": "8秒"},
|
||||
{"value": 10, "text": "10秒"}
|
||||
{"value": 10, "text": "10秒"},
|
||||
{"value": 12, "text": "12秒"},
|
||||
{"value": 15, "text": "15秒"}
|
||||
],
|
||||
"defaultvalue": 5
|
||||
},
|
||||
@ -48,9 +57,12 @@ INSERT IGNORE INTO uapiio (id, name, description, input_fields) VALUES (
|
||||
"uitype": "code",
|
||||
"data": [
|
||||
{"value": "adaptive", "text": "自适应"},
|
||||
{"value": "21:9", "text": "21:9"},
|
||||
{"value": "16:9", "text": "16:9"},
|
||||
{"value": "9:16", "text": "9:16"},
|
||||
{"value": "1:1", "text": "1:1"}
|
||||
{"value": "4:3", "text": "4:3"},
|
||||
{"value": "1:1", "text": "1:1"},
|
||||
{"value": "3:4", "text": "3:4"},
|
||||
{"value": "9:16", "text": "9:16"}
|
||||
],
|
||||
"defaultvalue": "adaptive"
|
||||
}
|
||||
@ -58,7 +70,6 @@ INSERT IGNORE INTO uapiio (id, name, description, input_fields) VALUES (
|
||||
);
|
||||
|
||||
-- === uapi: 创建视频任务 ===
|
||||
-- stream=async, chunk_match=task_id (从响应中提取task_id用于轮询)
|
||||
INSERT IGNORE INTO uapi (id, upappid, name, title, description, need_auth, stream, path, httpmethod, chunk_match, headers, params, data, response, ioid) VALUES (
|
||||
'm_h3_create_task',
|
||||
'minimax',
|
||||
@ -72,13 +83,37 @@ INSERT IGNORE INTO uapi (id, upappid, name, title, description, need_auth, strea
|
||||
'task_id',
|
||||
'{"Content-Type": "application/json", "Authorization": "Bearer {{apikey}}"}',
|
||||
NULL,
|
||||
'{{jsondata}}',
|
||||
'{
|
||||
"model": "{{model or "MiniMax-H3"}}",
|
||||
"content": [
|
||||
{% if image_files %}
|
||||
{% if isinstance(image_files, str) %}
|
||||
{% set image_files = [image_files] %}
|
||||
{% endif %}
|
||||
{% for img in image_files %}
|
||||
{
|
||||
"type": "image_url",
|
||||
"image_url": {"url": "{{b64media2url(request, img)}}"},
|
||||
"role": "first_frame"
|
||||
}{% if not loop.last or prompt %},{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if prompt %}
|
||||
{
|
||||
"type": "text",
|
||||
"text": {{json.dumps(prompt)}}
|
||||
}
|
||||
{% endif %}
|
||||
],
|
||||
"resolution": "{{resolution or "768P"}}",
|
||||
"duration": {{duration or 5}}{% if ratio %},
|
||||
"ratio": "{{ratio}}"{% endif %}
|
||||
}',
|
||||
'{{response}}',
|
||||
'm_h3_video_gen_io'
|
||||
);
|
||||
|
||||
-- === uapi: 查询视频任务 ===
|
||||
-- stream=sync (直接返回任务状态)
|
||||
INSERT IGNORE INTO uapi (id, upappid, name, title, description, need_auth, stream, path, httpmethod, chunk_match, headers, params, data, response, ioid) VALUES (
|
||||
'm_h3_query_task',
|
||||
'minimax',
|
||||
@ -93,7 +128,14 @@ INSERT IGNORE INTO uapi (id, upappid, name, title, description, need_auth, strea
|
||||
'{"Authorization": "Bearer {{apikey}}"}',
|
||||
NULL,
|
||||
NULL,
|
||||
'{{response}}',
|
||||
'{
|
||||
"task_id": "{{response.task.id}}",
|
||||
"status": "{{response.task.status}}",
|
||||
"video_url": "{{response.task.content.url}}",
|
||||
"resolution": "{{response.task.resolution}}",
|
||||
"duration": {{response.task.duration}},
|
||||
"ratio": "{{response.task.ratio}}"
|
||||
}',
|
||||
'm_h3_video_gen_io'
|
||||
);
|
||||
|
||||
@ -106,8 +148,3 @@ INSERT IGNORE INTO upapp (id, name, baseurl, myappid, ownerid, description) VALU
|
||||
'platform',
|
||||
'MiniMax 视频生成平台。提供 H3 视频生成模型。'
|
||||
);
|
||||
|
||||
-- === upappkey (请替换真实API Key) ===
|
||||
-- INSERT IGNORE INTO upappkey (id, upappid, orgid, apikey, enabled_date, expired_date) VALUES (
|
||||
-- 'mk_minimax_default', 'minimax', 'platform', '<RC4_ENCODED_KEY>', '2025-01-01', '9999-12-31'
|
||||
-- );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user