@@ -162,7 +162,15 @@ def handle_scenario_selection(self, user_input: str) -> str:
162162 self .state ['scenario' ] = detected_scenario
163163 self .state ['current_step' ] = 'input_collection'
164164 self .state ['session_active' ] = True
165- response = f"'{ detected_scenario } '로 인식했습니다! 이제 구매하신 상품에 대해 자유롭게 말씀해 주세요.\n \n 💡 **상품 묘사의 정확도가 높을수록 정확한 관세 예측이 가능합니다!**\n \n 예시:\n • \" 아랫창은 고무로 되어있고 하얀색 운동화를 80000원에 독일에서 샀어요\" \n • \" 인텔 i7 노트북을 150만원에 미국에서 구매했어요\" \n • \" 블루투스 이어폰 2개를 12만원에 일본에서 샀어요\" \n \n 위 예시를 참고하여 상품 정보를 입력해 주세요."
165+ response = (
166+ "구매하신 상품 정보를 입력해 주세요!\n \n "
167+ "💡 **상품 묘사의 정확도가 높을수록 정확한 관세 예측이 가능합니다!**\n \n "
168+ "예시:\n "
169+ "• \" 아랫창은 고무로 되어있고 하얀색 운동화를 80000원에 독일에서 샀어요\" \n "
170+ "• \" 인텔 i7 노트북을 150만원에 미국에서 구매했어요\" \n "
171+ "• \" 블루투스 이어폰 2개를 12만원에 일본에서 샀어요\" \n \n "
172+ "위 예시를 참고하여 상품 정보를 입력해 주세요."
173+ )
166174 self .state ['responses' ].append (response )
167175 return response
168176
@@ -171,7 +179,15 @@ def handle_scenario_selection(self, user_input: str) -> str:
171179 self .state ['scenario' ] = self .scenarios [user_input ]
172180 self .state ['current_step' ] = 'input_collection'
173181 self .state ['session_active' ] = True
174- response = f"'{ self .state ['scenario' ]} '로 선택하셨습니다! 이제 구매하신 상품에 대해 자유롭게 말씀해 주세요.\n \n 💡 **상품 묘사의 정확도가 높을수록 정확한 관세 예측이 가능합니다!**\n \n 예시:\n • \" 아랫창은 고무로 되어있고 하얀색 운동화를 80000원에 독일에서 샀어요\" \n • \" 인텔 i7 노트북을 150만원에 미국에서 구매했어요\" \n • \" 블루투스 이어폰 2개를 12만원에 일본에서 샀어요\" \n \n 위 예시를 참고하여 상품 정보를 입력해 주세요."
182+ response = (
183+ "구매하신 상품 정보를 입력해 주세요!\n \n "
184+ "💡 **상품 묘사의 정확도가 높을수록 정확한 관세 예측이 가능합니다!**\n \n "
185+ "예시:\n "
186+ "• \" 아랫창은 고무로 되어있고 하얀색 운동화를 80000원에 독일에서 샀어요\" \n "
187+ "• \" 인텔 i7 노트북을 150만원에 미국에서 구매했어요\" \n "
188+ "• \" 블루투스 이어폰 2개를 12만원에 일본에서 샀어요\" \n \n "
189+ "위 예시를 참고하여 상품 정보를 입력해 주세요."
190+ )
175191 self .state ['responses' ].append (response )
176192 return response
177193
@@ -203,15 +219,35 @@ def handle_input_collection(self, user_input: str) -> str:
203219 parsed = self .parse_user_input (enhanced_input )
204220 # 필수 정보 확인
205221 missing_info = []
206- if 'product_name' not in parsed :
207- missing_info .append ("상품에 대한 묘사 " )
208- if 'country' not in parsed :
222+ if 'product_name' not in parsed or not parsed [ 'product_name' ] :
223+ missing_info .append ("상품명 " )
224+ if 'country' not in parsed or not parsed [ 'country' ] :
209225 missing_info .append ("구매 국가" )
210- if 'price' not in parsed :
226+ if 'price' not in parsed or not parsed [ 'price' ] :
211227 missing_info .append ("상품 가격" )
212228 if missing_info :
229+ # 이미 입력된 정보는 보여주고, 누락된 정보만 안내
230+ info_lines = []
231+ if 'product_name' in parsed and parsed ['product_name' ]:
232+ info_lines .append (f"상품명: { parsed ['product_name' ]} " )
233+ if 'country' in parsed and parsed ['country' ]:
234+ info_lines .append (f"구매 국가: { parsed ['country' ]} " )
235+ if 'price' in parsed and parsed ['price' ]:
236+ info_lines .append (f"상품 가격: { parsed ['price' ]:,} 원" )
237+ if 'quantity' in parsed and parsed ['quantity' ]:
238+ info_lines .append (f"수량: { parsed ['quantity' ]} 개" )
239+ info_str = "\n " .join (info_lines )
213240 missing_str = ", " .join (missing_info )
214- response = f"다음 정보가 누락되었습니다: { missing_str } \n \n 💡 **상품 묘사의 정확도가 높을수록 정확한 관세 예측이 가능합니다!**\n \n 예시:\n • \" 아랫창은 고무로 되어있고 하얀색 운동화를 80000원에 독일에서 샀어요\" \n • \" 인텔 i7 노트북을 150만원에 미국에서 구매했어요\" \n • \" 블루투스 이어폰 2개를 12만원에 일본에서 샀어요\" "
241+ response = (
242+ (info_str + "\n \n " if info_str else "" ) +
243+ f"다음 정보가 누락되었습니다: { missing_str } \n "
244+ "💡 **상품명, 구매 국가, 상품 가격을 모두 입력해 주세요!**\n \n "
245+ "예시:\n "
246+ "• \" 미국에서 150만원에 노트북을 샀어요\" \n "
247+ "• \" 일본에서 10만원짜리 이어폰을 구매했어요\" \n "
248+ "• \" 독일에서 80만원에 운동화 2켤레를 샀어요\" \n \n "
249+ "위 예시를 참고하여 상품 정보를 입력해 주세요."
250+ )
215251 self .state ['responses' ].append (response )
216252 return response
217253 # 상태 업데이트
@@ -232,7 +268,9 @@ def handle_input_collection(self, user_input: str) -> str:
232268 return resp .message
233269 self .state ['hs6_candidates' ] = resp .hs6_candidates
234270 self .state ['current_step' ] = 'hs6_selection'
235- response = f"상품묘사: { parsed ['product_name' ]} \n 국가: { parsed ['country' ]} \n 가격: { parsed ['price' ]:,} 원\n 수량: { parsed .get ('quantity' , 1 )} 개\n \n HS6 코드 후보를 찾았습니다. 번호를 선택해 주세요:\n " + '\n ' .join ([
271+ scenario_str = self .state .get ('scenario' , '' )
272+ scenario_guide = f"{ scenario_str } 로 예상하고 안내를 도와드릴게요.\n \n " if scenario_str else ""
273+ response = scenario_guide + f"상품묘사: { parsed ['product_name' ]} \n 국가: { parsed ['country' ]} \n 가격: { parsed ['price' ]:,} 원\n 수량: { parsed .get ('quantity' , 1 )} 개\n \n HS6 코드 후보를 찾았습니다. 번호를 선택해 주세요:\n " + '\n ' .join ([
236274 f"{ i + 1 } . { c ['code' ]} - { c ['description' ]} (신뢰도: { c ['confidence' ]} )" for i , c in enumerate (resp .hs6_candidates or [])
237275 ]) + f"\n \n 💡 **위 후보 중 하나를 선택해 주세요.**\n 예시: \" 1번\" , \" 2번\" , \" 3번\" 등"
238276 self .state ['responses' ].append (response )
@@ -268,7 +306,7 @@ def handle_hs6_selection(self, user_input: str) -> str:
268306 return resp .message
269307 self .state ['hs10_candidates' ] = resp .hs10_candidates
270308 self .state ['current_step' ] = 'hs10_selection'
271- response = f"선택하신 HS6 코드: { selected ['code' ]} \n \n HS10 코드 후보를 선택해 주세요:\n " + '\n ' .join ([
309+ response = f"선택하신 HS 6자리 코드: { selected ['code' ]} \n \n HS 10자리 코드 후보를 선택해 주세요:\n " + '\n ' .join ([
272310 f"{ i + 1 } . { c ['code' ]} - { c ['description' ]} " for i , c in enumerate (resp .hs10_candidates or [])
273311 ]) + f"\n \n 💡 **위 후보 중 하나를 선택해 주세요.**\n 예시: \" 1번\" , \" 2번\" , \" 3번\" 등"
274312 self .state ['responses' ].append (response )
0 commit comments