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",