ns = params_kw.copy()
kb_id = ns.get('kb_id', '')
namestr = ns.get('name', '')

if not kb_id:
    return json.dumps({"status": "error", "error": "kb_id required"}, ensure_ascii=False)

result = {
    "widgettype": "VBox",
    "options": {"padding": "20px", "spacing": "14px", "width": "100%", "alignItems": "center"},
    "subwidgets": [
        {"widgettype": "Text", "options": {"text": "\u26a0\ufe0f \u786e\u8ba4\u5220\u9664\u77e5\u8bc6\u5e93",
             "cfontsize": 16, "fontWeight": "bold", "color": "#e74c3c", "halign": "center"}},
        {"widgettype": "Text", "options": {"text": "\u300c" + namestr + "\u300d",
             "cfontsize": 14, "color": "#333", "halign": "center"}},
        {"widgettype": "Text", "options": {"text": "\u8be5\u64cd\u4f5c\u4f1a\u5220\u9664\u77e5\u8bc6\u5e93\u5185\u6240\u6709\u6587\u4ef6\u3001\u6807\u7b7e\u548c\u6570\u636e\uff0c\u4e0d\u53ef\u6062\u590d\uff01",
             "cfontsize": 12, "color": "#999", "halign": "center"}},
        {"widgettype": "HBox", "options": {"spacing": "12px", "justifyContent": "center"},
         "subwidgets": [
             {"widgettype": "Button", "options": {"label": "\u53d6\u6d88",
                  "bgcolor": "#f0f0f0", "color": "#666", "padding": "6px 20px", "borderRadius": "6px"},
              "binds": [{"wid": "self", "event": "click", "actiontype": "script",
                         "script": "var pw=null;var w=this;while(w){if(w instanceof bricks.PopupWindow||w instanceof bricks.Popup){pw=w;break};w=w.parent};if(pw){pw.dismiss();pw.destroy()}"}]},
             {"widgettype": "Button", "options": {"label": "\u786e\u8ba4\u5220\u9664",
                  "bgcolor": "#e74c3c", "color": "#fff", "padding": "6px 20px", "borderRadius": "6px"},
              "binds": [{"wid": "self", "event": "click", "actiontype": "script",
                         "script": "var pw=null;var w=this;while(w){if(w instanceof bricks.PopupWindow||w instanceof bricks.Popup){pw=w;break};w=w.parent};if(pw){pw.dismiss();pw.destroy()};window.location.href='/rag/knowledge_bases_list/delete_kb.dspy?kb_id=" + kb_id + "'"}]}
         ]}
    ]
}
return result
