From d3a4e3f3e77a3da0dae727e4522ec84d4e01aee5 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Sat, 7 Mar 2026 22:31:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=85=88=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9A=84=20config=5Fschema.json=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E4=BE=9B=E5=AF=8C=20UI=20=E5=85=83=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/webui/routers/plugin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/webui/routers/plugin.py b/src/webui/routers/plugin.py index 3c7d5ae1..3a7c65ed 100644 --- a/src/webui/routers/plugin.py +++ b/src/webui/routers/plugin.py @@ -1528,6 +1528,16 @@ async def get_plugin_config_schema( if not plugin_path: raise HTTPException(status_code=404, detail=f"未找到插件: {plugin_id}") + # 优先读取 config_schema.json(插件可选提供的富 UI 元数据) + schema_json_path = plugin_path / "config_schema.json" + if schema_json_path.exists(): + try: + with open(schema_json_path, "r", encoding="utf-8") as f: + schema = json.load(f) + return {"success": True, "schema": schema} + except Exception as e: + logger.warning(f"读取 config_schema.json 失败,回退到自动推断: {e}") + # 读取配置文件获取当前配置 config_path = plugin_path / "config.toml" current_config = {}