# -*- coding: utf-8 -*- import json, ssl, pathlib, urllib.request, urllib.error BASE = "https://192.168.31.88:8042" CFG = pathlib.Path(r"C:\Users\admin\.zcode\cli\config.json") pat = json.loads(CFG.read_text(encoding="utf-8-sig"))["mcp"]["servers"]["sorb"]["env"]["SORB_PAT"] ctx = ssl._create_unverified_context() PROMPT = """以参考图1为吕布与赤兔的造型基准(同一人物、同一匹马、同一把方天画戟,面部、铠甲、红披风、红鬃、鞍具全部保持一致),镜头改为正侧面全景,构图原创,不复制任何已有影视画面。 吕布从城门里向野外全速策马:城门只在画面右后方远处,开阔野外在画面左前方;吕布与赤兔从右向左疾驰,马头与吕布面朝左,红披风、双翎、红鬃与马尾向右后方拖曳。不是朝城门跑,不是冲镜头,不是向右跑。 完整马身入画,四条腿清晰、四个蹄子,前腿屈收、后腿蹬伸,马颈与躯干比例自然,无多余肢体、无扭曲、无透视畸变。 侧向低机位跟拍中景:吕布伏低上身,画戟向前平指;赤兔四蹄疾驰,雪尘向右后方拖出长尾。右后方一座汉代关隘与城墙远景,左前方辽阔雪原与远山。清晨低角度侧逆光,人物与马鬃轮廓金边,冷青阴影+暖金高光,浅景深、胶片颗粒、边缘暗角,16:9,无文字无水印无旗帜。""" payload = { "client_namespace": "lubu_pv_board", "idempotency_key": "lubu_s1_charge_gallop_20261027_v3", "project_id": 30, "model_config_id": 62, "task_type": "image", "references": [ {"source_type": "task_output", "id": 16878, "asset_type": "image", "role": "reference_image"}, {"source_type": "media_asset", "id": 9048, "asset_type": "image", "role": "reference_image"}, ], "parameters": {"prompt": PROMPT, "aspect_ratio": "16:9", "image_size": "2K", "output_format": "png", "watermark": False}, } data = json.dumps(payload, ensure_ascii=False).encode("utf-8") req = urllib.request.Request(BASE + "/api/external/v1/tasks", data=data, method="POST", headers={"Authorization": "Bearer " + pat, "Content-Type": "application/json"}) try: with urllib.request.urlopen(req, context=ctx, timeout=120) as r: o = json.loads(r.read().decode("utf-8")) print("task_id=", o.get("task", {}).get("id"), "status=", o.get("task", {}).get("status")) except urllib.error.HTTPError as e: print("HTTP", e.code, e.read().decode("utf-8")[:800])