Files
my-v0-server/app/schemas/actions/update_canvas.py
T
2026-10-15 03:38:20 -07:00

23 lines
989 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""仅更新画布属性,不修改组件或数据源"""
from typing import Literal
from pydantic import Field, JsonValue
from app.schemas.base import NonBlankString
from .base import ActionModel
class UpdateCanvasAction(ActionModel):
"""修改画布属性"""
type: Literal["update_canvas"] = "update_canvas"
properties: dict[NonBlankString, JsonValue] = Field(
min_length=1,
description="要替换的 canvas 顶层字段及最终值,如 width、height、theme(light 亮色 / dark 深色)、backgroundColor;未提供的字段保持不变。"
"改 theme 会让组件里跟随主题的颜色一起变;backgroundColor 写 null 表示用主题的背景色。改变画布尺寸不会自动缩放或移动组件。"
'variables 是大屏变量的完整列表(整组替换,保留已有的),例如 [{"id": "page", "name": "当前页", "default": "sales"}];'
"组件怎么读写变量用 set_interaction 设置",
)