# -*- 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 = """【锁死吕布与赤兔】画面中的吕布必须100%就是参考图1的吕布:黑色高束发髻、金色凤翅束发冠、两侧双根鲜红超长翎羽;面部与参考图1完全一致——剑眉浓黑上扬、眼窝深、眼神锐利、鼻梁高挺、下颌线清晰、年轻英武;兽面吞头连环铠(双肩兽头吞甲、胸前双圆护胸铜片、黑色护腕、腰部干净高级灰皮毛裙边)、红色长披风。兵器方天画戟严格按参考图3:月牙双刃+中央枪尖+戟尾配重、红色戟缨缠绕杆身。赤兔必须100%按参考图2:红鬃、深枣红马身、黑色皮质马鞍+金色鞍饰+红色缨穗+完整鞍布,毛色与马具形制不得改动,不得换成其他马。 【解剖与方向】马体结构必须正确:四条腿清晰、四个蹄子、脖颈与躯干比例自然;马正面朝镜头方向缓步前行或小跑,禁止多余腿、扭曲躯干、过大头部、透视畸变。吕布端坐马背、上身正直,方天画戟竖持于身侧,戟尖朝上。 【镜头】低角度正面中景:吕布骑赤兔迎面走来,马与人正面朝向镜头,迎着风雪行进。前景雪花被寒风卷向镜头,近处雪片大且虚化,雪幕层层叠叠;吕布红披风与双红翎被寒风向一侧猛吹,赤兔红鬃迎风飞扬。清晨低角度侧光从画面左侧照来,雪片在光中闪烁,人物面部半明半暗、眼神凛冽。背景:参考图4的虎牢关关隘在风雪中若隐若现,冷青蓝晨雾与远山。电影级调色:冷青阴影+暖金高光,胶片颗粒,暗角,浅景深,16:9。无文字无水印无旗帜。""" payload = { "client_namespace": "lubu_pv_board", "idempotency_key": "lubu_s1_snow_front_20261027_v1", "project_id": 30, "model_config_id": 62, "task_type": "image", "references": [ {"source_type": "media_asset", "id": 9089, "asset_type": "image", "role": "reference_image"}, {"source_type": "media_asset", "id": 9047, "asset_type": "image", "role": "reference_image"}, {"source_type": "media_asset", "id": 9057, "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])