File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,12 @@ def execute_query(
5757 Returns:
5858 dict: 변환된 SQL 쿼리 및 관련 메타데이터를 포함하는 결과 딕셔너리.
5959 """
60+ # 세션 상태에서 그래프 가져오기
61+ graph = st .session_state .get ("graph" )
62+ if graph is None :
63+ graph = builder .compile ()
64+ st .session_state ["graph" ] = graph
6065
61- graph = builder .compile ()
6266 res = graph .invoke (
6367 input = {
6468 "messages" : [HumanMessage (content = query )],
@@ -113,6 +117,16 @@ def display_result(
113117
114118st .title ("Lang2SQL" )
115119
120+ # 세션 상태 초기화
121+ if "graph" not in st .session_state :
122+ st .session_state ["graph" ] = builder .compile ()
123+ st .info ("Lang2SQL이 성공적으로 시작되었습니다." )
124+
125+ # 새로고침 버튼 추가
126+ if st .sidebar .button ("Lang2SQL 새로고침" ):
127+ st .session_state ["graph" ] = builder .compile ()
128+ st .sidebar .success ("Lang2SQL이 성공적으로 새로고침되었습니다." )
129+
116130user_query = st .text_area (
117131 "쿼리를 입력하세요:" ,
118132 value = DEFAULT_QUERY ,
You can’t perform that action at this time.
0 commit comments