fix(web): solve p0 mapping, nested validation, and add health checks

这个提交包含在:
2026-01-21 16:01:40 +08:00
父节点 e30cd6d93f
当前提交 85787fb572
共修改 7 个文件,包含 232 行新增和 23 行删除
+24 -5
查看文件
@@ -178,10 +178,11 @@ def show_algo_library():
# 环境状态概览
with st.expander("🖥️ 当前环境能力", expanded=False):
col1, col2, col3 = st.columns(3)
col1, col2, col3, col4 = st.columns(4)
col1.metric("Python", "✅ 可用")
col2.metric("MATLAB/Octave", "✅ 可用" if "matlab" in available_types else "❌ 不可用")
col3.metric("C++ 运行时", "✅ 可用" if "cpp" in available_types else "❌ 不可用")
col4.metric("Web 桥接", "✅ 可用" if "web" in available_types else "❌ 不可用")
st.json(env)
st.subheader("已注册算法")
@@ -208,6 +209,16 @@ def show_algo_library():
st.write(f"**入口**: `{algo.get('lib_path', 'N/A')}::{algo.get('function', 'N/A')}`")
elif algo_type == "matlab":
st.write(f"**入口**: `{algo.get('m_path', 'N/A')}::{algo.get('function', 'N/A')}`")
elif algo_type == "web":
endpoint = algo.get('endpoint', 'N/A')
st.write(f"**端点**: `{endpoint}`")
if st.button(f"🌐 测试连接: {algo['name']}", key=f"ping_{algo['name']}"):
from src.env_detect import check_endpoint_active
active, msg = check_endpoint_active(endpoint)
if active:
st.success(f"✅ 联通正常: {msg}")
else:
st.error(f"❌ 无法访问: {msg}")
else:
st.write(f"**入口**: `{algo.get('function', 'N/A')}`")
@@ -395,10 +406,18 @@ def show_scheduling():
param: (spec or {}).get("field") or param
for param, spec in (algo.get("inputs") or {}).items()
}
out_map = {
str((spec or {}).get("index", 0)): field
for field, spec in (algo.get("outputs") or {}).items()
}
if algo_type == "web":
# Web 类型使用 Key 映射 (如 transmission_loss -> vis_data.tl_result_path)
out_map = {
field_name: (spec or {}).get("field") or field_name
for field_name, spec in (algo.get("outputs") or {}).items()
}
else:
# 传统类型使用 Index 映射 (如 0 -> clean_data)
out_map = {
str((spec or {}).get("index", 0)): field
for field, spec in (algo.get("outputs") or {}).items()
}
preprocessing = []
from src.bridges import PythonBridge, CppBridge