# -*- 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的吕布本人:黑色高束发髻、金色凤翅束发冠、两侧双根鲜红超长弯曲翎羽;面部与参考图1完全一致(剑眉浓黑、眼窝深、眼神锐利、鼻梁高挺、下颌清晰);兽面吞头连环铠(双肩兽头吞甲、胸前双圆护胸铜片、黑色护腕、腰部干净高级灰皮毛裙边、红色长披风)。兵器方天画戟严格按参考图2。绝不是其他角色。 【镜头】超低角度仰拍英雄镜头:吕布在画面右三分之一,画戟长杆自右下前景斜贯至左上、戟尖寒光;红披风被狂风卷向左侧占满画面;双翎向后猎猎。清晨低角度侧逆光自左后方勾出铠甲/双翎/披风金边,面部半明半暗;前景虚化雪尘;背景参考图3关隘古道虚化为冷青蓝剪影晨雾。 【质感】3D超写实三国历史正剧CG,UE5.2光追,3D动画CG质感非真人实拍,冷青阴影+暖金高光,胶片颗粒,暗角,浅景深,16:9,无文字无水印无旗帜。""" payload = { "client_namespace": "lubu_pv_board", "idempotency_key": "lubu_board_S13_20261024_v4_gpt_short", "project_id": 30, "model_config_id": 88, "task_type": "image", "references": [ {"source_type": "media_asset", "id": 9089, "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": "4K", "quality": "max", "output_format": "png", "n": 1}, } 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: body = r.read().decode("utf-8") print("HTTP", r.status, body[:1000]) o = json.loads(body) print("TASK_ID", o.get("task", {}).get("id")) except urllib.error.HTTPError as e: print("HTTP", e.code, e.read().decode("utf-8")[:1000])