From 085623f700ef7d296202fb5020161e2f6002e301 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 16 Aug 2026 18:41:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8A=9F=E8=83=BD=E5=BC=B9=E7=AA=97?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E6=94=B9width/height=E7=99=BE=E5=88=86?= =?UTF-8?q?=E6=AF=94(85%/80%),cwidth/cheight=E5=AD=97=E7=AC=A6=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E5=A4=AA=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/agent_menu_open.dspy | 18 +++++------------- wwwroot/api/agent_menus.dspy | 6 +++--- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/wwwroot/api/agent_menu_open.dspy b/wwwroot/api/agent_menu_open.dspy index fb53cb2..47a3adf 100644 --- a/wwwroot/api/agent_menu_open.dspy +++ b/wwwroot/api/agent_menu_open.dspy @@ -1,13 +1,14 @@ # agent_menu_open.dspy - 通用功能弹窗:返回 PopupWindow,内嵌 urlwidget 加载目标 .ui # 供 AgentIO 上方功能菜单按钮用(按钮 actiontype=urlwidget 打开本 dspy,通过参数控制弹窗大小) -# 参数:url(必填) title cwidth cheight +# 参数:url(必填) title width height(百分比字符串,默认 85%/80%) +# 注意:PopupWindow 用 width/height 百分比(cwidth/cheight 是字符单位,对列表页太小) import json url = (params_kw or {}).get('url', '') or '' title = (params_kw or {}).get('title', '') or '功能' -cwidth = (params_kw or {}).get('cwidth', '') or '62' -cheight = (params_kw or {}).get('cheight', '') or '32' +width = (params_kw or {}).get('width', '') or '85%' +height = (params_kw or {}).get('height', '') or '80%' if not url: return json.dumps({ @@ -15,18 +16,9 @@ if not url: "options": {"text": "缺少 url 参数", "cfontsize": 1, "color": "#64748b", "padding": "20px"} }, ensure_ascii=False) -try: - cw = float(cwidth) -except Exception: - cw = 62 -try: - ch = float(cheight) -except Exception: - ch = 32 - return json.dumps({ "widgettype": "PopupWindow", - "options": {"title": title, "cwidth": cw, "cheight": ch, "auto_open": True}, + "options": {"title": title, "width": width, "height": height, "auto_open": True}, "subwidgets": [ {"widgettype": "urlwidget", "options": {"url": entire_url(url)}} ] diff --git a/wwwroot/api/agent_menus.dspy b/wwwroot/api/agent_menus.dspy index aea96de..82f0645 100644 --- a/wwwroot/api/agent_menus.dspy +++ b/wwwroot/api/agent_menus.dspy @@ -58,9 +58,9 @@ for i, m in enumerate(menus): url = str(m.get("url", "") or "") if not url: continue - cwidth = str(m.get("cwidth", "62") or "62") - cheight = str(m.get("cheight", "32") or "32") - query = _urlparse.urlencode({"url": url, "title": label, "cwidth": cwidth, "cheight": cheight}) + width = str(m.get("width", "85%") or "85%") + height = str(m.get("height", "80%") or "80%") + query = _urlparse.urlencode({"url": url, "title": label, "width": width, "height": height}) open_url = "/pipeline_core/api/agent_menu_open.dspy?" + query buttons.append({ "widgettype": "Button",