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,48 @@
|
||||
"""全局设置(API 地址、device id)。
|
||||
|
||||
凭据(cookie / JWT)由 `tripocli account` 管理,这里只管非敏感设置。
|
||||
"""
|
||||
|
||||
from ..config import Config
|
||||
|
||||
|
||||
def _show(ctx):
|
||||
config = ctx.config
|
||||
info = {
|
||||
"config_path": str(config.path),
|
||||
"api_base": config.api_base,
|
||||
"device_id": config.device_id,
|
||||
"accounts_path": str(ctx.accounts.path),
|
||||
"active_account": ctx.accounts.active_name(),
|
||||
"accounts": ctx.accounts.names(),
|
||||
}
|
||||
ctx.out.data(
|
||||
info,
|
||||
human=lambda: (
|
||||
ctx.out.line(f"配置文件 : {info['config_path']}"),
|
||||
ctx.out.line(f"API Base : {info['api_base']}"),
|
||||
ctx.out.line(f"Device ID : {info['device_id']}"),
|
||||
ctx.out.line(f"账号文件 : {info['accounts_path']}"),
|
||||
ctx.out.line(f"当前账号 : {info['active_account'] or '未设置'}"),
|
||||
ctx.out.line(f"账号列表 : {', '.join(info['accounts']) or '空'}"),
|
||||
),
|
||||
)
|
||||
return info
|
||||
|
||||
|
||||
def _set(ctx):
|
||||
args = ctx.args
|
||||
ctx.config.set(device_id=args.device_id, api_base=args.api_base)
|
||||
ctx.out.data({"saved": True}, human=lambda: ctx.out.line("✅ 配置已保存"))
|
||||
return {"saved": True}
|
||||
|
||||
|
||||
def register(subparsers):
|
||||
parser = subparsers.add_parser("config", help="全局设置(API 地址 / device id)")
|
||||
sub = parser.add_subparsers(dest="config_action", required=True)
|
||||
sub.add_parser("show", help="显示当前设置").set_defaults(func=_show)
|
||||
|
||||
setter = sub.add_parser("set", help="修改 API 地址 / device id")
|
||||
setter.add_argument("--device-id", help="x-tripo-device-id")
|
||||
setter.add_argument("--api-base", help="API 根地址")
|
||||
setter.set_defaults(func=_set)
|
||||
Reference in new issue
Block a user