tripocli v2.0.0:Tripo AI 3D 生成与加工 CLI(面向 Agent 与开发者,纯 Python 标准库、零第三方依赖)
覆盖文生 3D、图生 3D、多视图、批量生成,以及重拓扑、绑定、动画、智能分割、 纹理、PBR、智能 UV、部件补全、格式导出与下载。 代码组织:一个功能一个模块(tripo/features/),入口薄壳 tripocli.py。
This commit is contained in:
commit
977f97995a
60 files changed
+5622
No files matched your search
@@ -0,0 +1,46 @@
|
||||
"""Terminal output helpers.
|
||||
|
||||
Every command prints either a human readable block or, with ``--json``, a single
|
||||
JSON document on stdout so an agent can parse it. Errors go to stderr (and to a
|
||||
JSON object on stdout when ``--json`` is active) so stdout stays machine safe.
|
||||
"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
class Out:
|
||||
def __init__(self, as_json=False):
|
||||
self.as_json = as_json
|
||||
|
||||
def json(self, payload):
|
||||
print(json.dumps(payload, indent=2, ensure_ascii=False))
|
||||
|
||||
def data(self, payload, human=None):
|
||||
"""Print ``payload`` as JSON, or ``human()`` when not in JSON mode."""
|
||||
if self.as_json:
|
||||
self.json(payload)
|
||||
elif human:
|
||||
human()
|
||||
|
||||
def line(self, text=""):
|
||||
if not self.as_json:
|
||||
print(text)
|
||||
|
||||
def notice(self, text):
|
||||
"""Progress/warning for humans; goes to stderr so stdout stays parseable."""
|
||||
print(text, file=sys.stderr)
|
||||
|
||||
def progress(self, text):
|
||||
"""In-place progress line; suppressed in JSON mode."""
|
||||
if not self.as_json:
|
||||
print(text, end="\r", flush=True)
|
||||
|
||||
def progress_done(self):
|
||||
if not self.as_json:
|
||||
print()
|
||||
|
||||
def error(self, message):
|
||||
if self.as_json:
|
||||
self.json({"error": str(message)})
|
||||
print(f"❌ {message}", file=sys.stderr)
|
||||
Reference in new issue
Block a user