From 0920680fe92085ce3c743bd8cb20840dc7f33cbc Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 24 Jun 2026 14:55:17 +0900 Subject: [PATCH] feat: simplify history UI by removing selectbox and rendering directly on table click --- app.py | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/app.py b/app.py index 3388cc5..e261a4a 100644 --- a/app.py +++ b/app.py @@ -809,35 +809,16 @@ def page_history(): selected_row_idx = selected_rows[0] if selected_row_idx < len(records): st.session_state["selected_analysis_id"] = records[selected_row_idx]["id"] + else: + # 선택 해제되었거나 최초 로딩 시, 기본적으로 가장 최근 분석(첫 번째 행)을 기본값으로 세팅 + valid_ids = [r["id"] for r in records] + if "selected_analysis_id" not in st.session_state or st.session_state["selected_analysis_id"] not in valid_ids: + st.session_state["selected_analysis_id"] = records[0]["id"] if records else 1 # 상세 조회 st.markdown("---") - st.subheader("🔎 상세 조회") - - # 보고서 선택을 돕는 UI 개선: 드롭다운 선택박스 제공 - history_options = [ - (r["id"], f"[ID: {r['id']}] {status_emoji.get(r['overall_status'], '')} {r['filename'][:30]} ({r['created_at']})") - for r in records - ] - - # 현재 선택된 ID에 해당하는 옵션의 인덱스 찾기 (양방향 연동용) - default_index = 0 - for idx, opt in enumerate(history_options): - if opt[0] == st.session_state["selected_analysis_id"]: - default_index = idx - break - - selected_option = st.selectbox( - "조회할 보고서 선택", - options=history_options, - index=default_index, - format_func=lambda x: x[1] - ) - - if selected_option: - st.session_state["selected_analysis_id"] = selected_option[0] - selected_id = st.session_state["selected_analysis_id"] + st.subheader(f"🔎 상세 조회 (보고서 ID: {selected_id})") detail = get_analysis_detail(selected_id) if not detail: