@@ -107,8 +107,6 @@ def intent_router(state: CustomsAgentState) -> CustomsAgentState:
107107 if is_in_tariff_session :
108108 state ["intent" ] = "tariff_prediction"
109109 _add_classification_message (state , "tariff_prediction" , "관세 예측 세션 연속성 유지" )
110- if not state .get ("session_id" ) or state .get ("session_id" ) in [None , '' ]:
111- state ["session_id" ] = str (uuid .uuid4 ())
112110 return state
113111 # 패턴 기반 분류
114112 is_number_selection = _is_number_selection (current_query )
@@ -117,49 +115,36 @@ def intent_router(state: CustomsAgentState) -> CustomsAgentState:
117115 if is_question :
118116 state ["intent" ] = "qna"
119117 _add_classification_message (state , "qna" , "질문 형태 감지(우선)" )
120- if prev_intent == "tariff_prediction" and state . get ( "session_id" ) :
118+ if prev_intent == "tariff_prediction" :
121119 try :
122120 from core .tariff_prediction .agent .tariff_prediction_agent import workflow_manager
123121 workflow_manager .cleanup_session (state ["session_id" ])
124122 except Exception :
125123 pass
126- state ["session_id" ] = None
127124 return state
128125 # 키워드 기반 분류
129126 keyword_intent = _classify_by_keywords (current_query )
130127 if keyword_intent :
131128 state ["intent" ] = keyword_intent
132129 _add_classification_message (state , keyword_intent , "키워드 기반 분류" )
133- if prev_intent == "tariff_prediction" and keyword_intent != "tariff_prediction" and state . get ( "session_id" ) :
130+ if prev_intent == "tariff_prediction" and keyword_intent != "tariff_prediction" :
134131 try :
135132 from core .tariff_prediction .agent .tariff_prediction_agent import workflow_manager
136133 workflow_manager .cleanup_session (state ["session_id" ])
137134 except Exception :
138135 pass
139- if keyword_intent == "tariff_prediction" :
140- if not state .get ("session_id" ) or state .get ("session_id" ) in [None , '' ]:
141- state ["session_id" ] = str (uuid .uuid4 ())
142- else :
143- state ["session_id" ] = None
144136 return state
145137 if is_number_selection :
146138 state ["intent" ] = "tariff_prediction"
147139 _add_classification_message (state , "tariff_prediction" , "숫자 선택 감지" )
148- if not state .get ("session_id" ) or state .get ("session_id" ) in [None , '' ]:
149- state ["session_id" ] = str (uuid .uuid4 ())
150140 return state
151141 intent = _classify_with_llm (current_query )
152142 state ["intent" ] = intent
153143 _add_classification_message (state , intent , "LLM 분류" )
154- if prev_intent == "tariff_prediction" and intent != "tariff_prediction" and state . get ( "session_id" ) :
144+ if prev_intent == "tariff_prediction" and intent != "tariff_prediction" :
155145 try :
156146 from core .tariff_prediction .agent .tariff_prediction_agent import workflow_manager
157147 workflow_manager .cleanup_session (state ["session_id" ])
158148 except Exception :
159149 pass
160- if intent == "tariff_prediction" :
161- if not state .get ("session_id" ) or state .get ("session_id" ) in [None , '' ]:
162- state ["session_id" ] = str (uuid .uuid4 ())
163- else :
164- state ["session_id" ] = None
165150 return state
0 commit comments