This commit is contained in:
2025-07-07 12:47:34 +08:00
parent b352571e17
commit fcb09c04f2
7 changed files with 464 additions and 13 deletions
+7 -7
View File
@@ -591,7 +591,7 @@ def render_indicator_management_expander():
def render_new_indicator_button():
"""渲染新建指标按钮"""
if st.button("新建"):
if st.button("新建"):
try:
# 生成新指标名称
indicator_count = len(st.session_state.indicator_manager.get_all_indicators())
@@ -613,7 +613,7 @@ def render_new_indicator_button():
def render_clear_indicators_button():
"""渲染清空指标按钮"""
if st.button("清空", help="删除所有指标", type="secondary"):
if st.button("🗑️清空", help="删除所有指标", type="secondary"):
st.session_state.indicator_manager.clear_all_indicators()
st.session_state.current_indicator_id = None
# 清除已生成的代码
@@ -633,7 +633,7 @@ def render_indicator_list():
else:
for indicator in sorted(indicators, key=lambda x: x.created_at):
if st.button(
indicator.name,
f"📄 {indicator.name}",
key=f"btn_{indicator.id}",
use_container_width=True,
type="primary" if st.session_state.current_indicator_id == indicator.id else "secondary"
@@ -694,7 +694,7 @@ def render_library_indicator_list(records):
"""渲染指标库列表"""
st.subheader("指标列表")
for i, record in enumerate(records):
if st.button(record.get("name", f"指标 {i+1}"), key=f"lib_btn_{i}", use_container_width=True):
if st.button(f"📚 {record.get('name', f'指标 {i+1}')}", key=f"lib_btn_{i}", use_container_width=True):
st.session_state.selected_index = i
# 清除第一个expander的选中状态
st.session_state.current_indicator_id = None
@@ -756,7 +756,7 @@ def render_library_indicator_code(library_indicator):
with result_col:
title_code_result = st.subheader("")
with run_btn_col:
if st.button("执行代码", key="execute_lib_indicator", use_container_width=True):
if st.button("▶️ 执行代码", key="execute_lib_indicator", use_container_width=True):
execute_indicator_code(library_indicator.get('code', ''), title_code_result)
# 显示代码
@@ -906,7 +906,7 @@ def render_code_execution_section(current_indicator):
with result_col:
title_code_result = st.subheader("")
with run_btn_col:
if st.button("执行代码", key="execute_code_btn", use_container_width=True):
if st.button("▶️ 执行代码", key="execute_code_btn", use_container_width=True):
with st.spinner("正在执行代码..."):
if "code_executor" in st.session_state and "generated_code" in st.session_state:
execute_and_update_code(current_indicator, title_code_result)
@@ -948,4 +948,4 @@ def execute_indicator_code(code, result_container):
if __name__ == "__main__":
main()
main()