Spaces:
Paused
Paused
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +4 -2
src/streamlit_app.py
CHANGED
|
@@ -200,6 +200,9 @@ def generate_llm_report(investor_style, ticker):
|
|
| 200 |
|
| 201 |
return result
|
| 202 |
|
|
|
|
|
|
|
|
|
|
| 203 |
|
| 204 |
# 1. 세션 상태(Session State) 초기화
|
| 205 |
# st.session_state : 스트림릿이 재실행되어도 값을 유지하는 변수
|
|
@@ -246,7 +249,7 @@ with col2:
|
|
| 246 |
quantity = st.number_input("보유 수량 (주)", min_value=0.01, step=0.1, format="%.2f")
|
| 247 |
|
| 248 |
# '종목 추가' 버튼
|
| 249 |
-
if st.button("➕ 포트폴리오에 추가", use_container_width=True):
|
| 250 |
selected_ticker = None
|
| 251 |
if selected_display:
|
| 252 |
selected_ticker = DISPLAY_TO_TICKER_MAP.get(selected_display)
|
|
@@ -261,7 +264,6 @@ if st.button("➕ 포트폴리오에 추가", use_container_width=True):
|
|
| 261 |
})
|
| 262 |
st.success(f"{selected_ticker} {quantity}주 (현재가 ${current_price:,.2f})를 포트폴리오에 추가했습니다.")
|
| 263 |
|
| 264 |
-
st.session_state.stock_search_input = None
|
| 265 |
st.rerun()
|
| 266 |
|
| 267 |
else:
|
|
|
|
| 200 |
|
| 201 |
return result
|
| 202 |
|
| 203 |
+
def reset_search_input():
|
| 204 |
+
if "stock_search_input" in st.session_state:
|
| 205 |
+
st.session_state.stock_search_input = None
|
| 206 |
|
| 207 |
# 1. 세션 상태(Session State) 초기화
|
| 208 |
# st.session_state : 스트림릿이 재실행되어도 값을 유지하는 변수
|
|
|
|
| 249 |
quantity = st.number_input("보유 수량 (주)", min_value=0.01, step=0.1, format="%.2f")
|
| 250 |
|
| 251 |
# '종목 추가' 버튼
|
| 252 |
+
if st.button("➕ 포트폴리오에 추가", use_container_width=True, on_click=reset_search_input):
|
| 253 |
selected_ticker = None
|
| 254 |
if selected_display:
|
| 255 |
selected_ticker = DISPLAY_TO_TICKER_MAP.get(selected_display)
|
|
|
|
| 264 |
})
|
| 265 |
st.success(f"{selected_ticker} {quantity}주 (현재가 ${current_price:,.2f})를 포트폴리오에 추가했습니다.")
|
| 266 |
|
|
|
|
| 267 |
st.rerun()
|
| 268 |
|
| 269 |
else:
|