File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,12 @@ def execute_query(
57
57
Returns:
58
58
dict: 변환된 SQL 쿼리 및 관련 메타데이터를 포함하는 결과 딕셔너리.
59
59
"""
60
+ # 세션 상태에서 그래프 가져오기
61
+ graph = st .session_state .get ("graph" )
62
+ if graph is None :
63
+ graph = builder .compile ()
64
+ st .session_state ["graph" ] = graph
60
65
61
- graph = builder .compile ()
62
66
res = graph .invoke (
63
67
input = {
64
68
"messages" : [HumanMessage (content = query )],
@@ -113,6 +117,16 @@ def display_result(
113
117
114
118
st .title ("Lang2SQL" )
115
119
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
+
116
130
user_query = st .text_area (
117
131
"쿼리를 입력하세요:" ,
118
132
value = DEFAULT_QUERY ,
You can’t perform that action at this time.
0 commit comments