diff --git a/wwwroot/api/cockpit_context_update.dspy b/wwwroot/api/cockpit_context_update.dspy index e756a00..cb08ec7 100644 --- a/wwwroot/api/cockpit_context_update.dspy +++ b/wwwroot/api/cockpit_context_update.dspy @@ -65,11 +65,26 @@ async with DBPools().sqlorContext(dbname) as sor: if irecs and len(irecs) > 0: iname = getattr(irecs[0], 'iteration_name', '') or '' - return json.dumps({ - "success": True, - "project_id": new_pid, - "iteration_id": new_iid, - "project_name": pname, - "iteration_name": iname, - "workspace_dir": ws_dir, - }, ensure_ascii=False) + # Return widget descriptor that auto-closes popup and refreshes context + if pid: + label = "项目「" + pname + "」" + else: + label = "迭代「" + iname + "」" + + widget = { + "widgettype": "VBox", + "options": {"padding": "16px", "alignItems": "center", "gap": "8px"}, + "subwidgets": [ + {"widgettype": "Text", "options": {"text": "\u2713 \u5df2\u8bbe\u7f6e", "cfontsize": 1.2, "color": "#16a34a", "fontWeight": "bold"}}, + {"widgettype": "Text", "options": {"text": label, "cfontsize": 0.95, "color": "#475569"}}, + {"widgettype": "Text", "options": {"text": "\u5f39\u7a97\u5c06\u81ea\u52a8\u5173\u95ed", "cfontsize": 0.8, "color": "#94a3b8"}}, + ], + "binds": [{ + "wid": "self", + "event": "render", + "actiontype": "script", + "target": "self", + "script": "setTimeout(function(){var pps=document.querySelectorAll('.popup-window');for(var i=0;i