feat: add enable_cache toggle for UI data caching (#1075)

This commit is contained in:
you-n-g
2025-07-15 22:26:06 +08:00
committed by GitHub
parent 8974704567
commit 5496168d07
3 changed files with 12 additions and 2 deletions
+5 -1
View File
@@ -8,6 +8,7 @@ from pathlib import Path
import streamlit as st
from streamlit import session_state
from rdagent.log.ui.conf import UI_SETTING
from rdagent.log.utils import extract_evoid, extract_loopid_func_name
st.set_page_config(layout="wide", page_title="debug_llm", page_icon="🎓", initial_sidebar_state="expanded")
@@ -18,7 +19,6 @@ parser.add_argument("--log_dir", type=str, help="Path to the log directory")
args = parser.parse_args()
@st.cache_data
def get_folders_sorted(log_path):
"""缓存并返回排序后的文件夹列表,并加入进度打印"""
with st.spinner("正在加载文件夹列表..."):
@@ -31,6 +31,10 @@ def get_folders_sorted(log_path):
return [folder.name for folder in folders]
if UI_SETTING.enable_cache:
get_folders_sorted = st.cache_data(get_folders_sorted)
# 设置主日志路径
main_log_path = Path(args.log_dir) if args.log_dir else Path("./log")
if not main_log_path.exists():