chore: fix PR template (#487)

* fix PR template

* subfolders of the log displayed on the web page

* fix code error

* add health check

* reformat with isort

* reformat with black

* update README

* fix bug && experience confusing

* reformat with black & update health check code

* reformat with isort

* reformat with black

* update README.md

* Removed duplicates in documentation and health_check && Upgraded code for filtering folders

* update docs

* reformat with black
This commit is contained in:
Linlang
2024-11-28 15:35:13 +08:00
committed by GitHub
parent c3f78f8bce
commit ea85d5efc8
7 changed files with 125 additions and 27 deletions
+21 -6
View File
@@ -61,9 +61,25 @@ QLIB_SELECTED_METRICS = [
SIMILAR_SCENARIOS = (QlibModelScenario, DMModelScenario, QlibFactorScenario, QlibFactorFromReportScenario, KGScenario)
def filter_log_folders(main_log_path):
"""
The webpage only displays valid folders.
If the __session__ folder exists in a subfolder of the log folder, it is considered a valid folder,
otherwise it is considered an invalid folder.
"""
folders = [
folder.relative_to(main_log_path)
for folder in main_log_path.iterdir()
if folder.is_dir() and folder.joinpath("__session__").exists() and folder.joinpath("__session__").is_dir()
]
folders = sorted(folders, key=lambda x: x.name)
return folders
if "log_path" not in state:
if main_log_path:
state.log_path = next(main_log_path.iterdir()).relative_to(main_log_path)
state.log_path = filter_log_folders(main_log_path)[0]
else:
state.log_path = None
st.toast(":red[**Please Set Log Path!**]", icon="⚠️")
@@ -505,7 +521,7 @@ def research_window():
# pdf image
if pim := state.msgs[round]["r.extract_factors_and_implement.load_pdf_screenshot"]:
for i in range(min(2, len(pim))):
st.image(pim[i].content, use_column_width=True)
st.image(pim[i].content, use_container_width=True)
# Hypothesis
if hg := state.msgs[round]["r.hypothesis generation"]:
@@ -526,7 +542,7 @@ def research_window():
with c1:
if pim := state.msgs[round]["r.pdf_image"]:
for i in range(len(pim)):
st.image(pim[i].content, use_column_width=True)
st.image(pim[i].content, use_container_width=True)
# loaded model exp
with c2:
@@ -679,8 +695,7 @@ with st.sidebar:
if manually:
st.text_input("log path", key="log_path", on_change=refresh, label_visibility="collapsed")
else:
folders = [folder.relative_to(main_log_path) for folder in main_log_path.iterdir() if folder.is_dir()]
folders = sorted(folders, key=lambda x: x.name)
folders = filter_log_folders(main_log_path)
st.selectbox(f"**Select from `{main_log_path}`**", folders, key="log_path", on_change=refresh)
else:
st.text_input(":blue[**log path**]", key="log_path", on_change=refresh)
@@ -763,7 +778,7 @@ with st.container():
image_c, scen_c = st.columns([3, 3], vertical_alignment="center")
with image_c:
img_path = rfiles("rdagent.log.ui").joinpath("flow.png")
st.image(str(img_path), use_column_width=True)
st.image(str(img_path), use_container_width=True)
with scen_c:
st.header("Scenario Description📖", divider="violet", anchor="_scenario")
if state.scenario is not None: