40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
"""Web App 产物模式配置(多页面站点生成/构建/预览)。"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from pydantic import BaseModel, Field
|
||
|
||
|
||
class WebAppConfig(BaseModel):
|
||
"""站点产物(outputs/ 下的 site.json 站点)总开关与构建参数。
|
||
|
||
默认关闭:模板未预置 node_modules 或未启用时,所有站点 API 返回
|
||
结构化的"不可用"响应,智能体技能自动回退单页 HTML 模式,
|
||
不影响任何既有功能。
|
||
"""
|
||
|
||
enabled: bool = Field(
|
||
default=False,
|
||
description="总开关:关闭时 capability 返回不可用,入口按钮不渲染,技能回退单页 HTML",
|
||
)
|
||
template_dir: str = Field(
|
||
default="templates/web-app-template",
|
||
description="站点模板目录(相对 project root 或绝对路径;含预置 node_modules 与 scripts/build_site.py)",
|
||
)
|
||
build_timeout_seconds: int = Field(
|
||
default=180,
|
||
ge=10,
|
||
le=1800,
|
||
description="单次 vite build 超时(秒),超时强杀子进程",
|
||
)
|
||
preview_token_ttl_seconds: int = Field(
|
||
default=7200,
|
||
ge=60,
|
||
le=86400,
|
||
description="站点预览签名 URL 有效期(秒)",
|
||
)
|
||
node_path: str = Field(
|
||
default="",
|
||
description="node 可执行文件覆盖(空 = PATH 查找;一般无需配置)",
|
||
)
|