423baff73b
- Docker bridge 网络隔离(8000 端口封死) - Gunicorn 4 Worker 多进程 - Alembic 数据库迁移基线 - 日志轮转 20m×3 - JWT 密钥 + DB 密码 + CORS 收紧 - 3-2-1 备份链路(NAS + R740-B 冷备) - 连接池 pool_pre_ping + pool_recycle=3600
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
"""
|
|
Action Card 协议 v1 Schema & 回调处理
|
|
"""
|
|
from __future__ import annotations
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class ActionCardField(BaseModel):
|
|
label: str
|
|
value: str
|
|
editable: bool = False
|
|
|
|
|
|
class ActionButton(BaseModel):
|
|
key: str # "confirm" | "cancel" | "edit"
|
|
label: str # "确认建单" | "取消"
|
|
style: str = "primary" # "primary" | "danger" | "default"
|
|
|
|
|
|
class ActionCardPayload(BaseModel):
|
|
card_id: str # 前端生成的唯一 ID
|
|
card_type: str # "create_order" | "create_customer" | "create_shipping" ...
|
|
title: str
|
|
summary: str
|
|
fields: list[ActionCardField] = []
|
|
actions: list[ActionButton] = []
|
|
params: dict = {} # 原始工具参数,回调时传回
|
|
|
|
|
|
class ActionCardCallback(BaseModel):
|
|
"""前端点击确认/取消后的回调请求"""
|
|
card_id: str | None = None
|
|
card_type: str
|
|
action_key: str # "confirm" | "cancel"
|
|
params: dict = {} # 可能被用户在卡片上修改过的参数
|