Skip to content

Commit a4596c4

Browse files
committed
chore: 관세 재예측 문구 추가
1 parent 526b066 commit a4596c4

4 files changed

Lines changed: 19 additions & 28 deletions

File tree

core/shared/constants/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
# 질문 형태 감지 패턴
3636
QUESTION_PATTERNS = [
3737
r'\?$', # 물음표로 끝나는 경우
38+
r'뭐야', r'뭔가요', r'무엇이야', r'무엇인가요',
3839
r'^어떻게', r'^무엇', r'^언제', r'^어디서', r'^왜', r'^누가',
3940
r'^무슨', r'^어떤', r'^얼마나', r'^어디', r'^언제', r'^왜',
4041
r'알려줘', r'알려주세요', r'궁금해', r'궁금합니다'

core/shared/router/intent_router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def intent_router(state: CustomsAgentState) -> CustomsAgentState:
120120
# 질문 형태이면서 관세 예측 세션이 아닌 경우 QnA로 분류
121121
if is_question:
122122
state["intent"] = "qna"
123-
_add_classification_message(state, "qna", "질문 형태 감지")
123+
_add_classification_message(state, "qna", "질문 형태 감지(우선)")
124124
return state
125125

126126
# 키워드 기반 분류

core/tariff_prediction/agent/tariff_prediction_agent.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def handle_input_collection(self, user_input: str) -> str:
264264
price_display = f"{original_price} {original_unit} ({price:,.0f}원)"
265265
response = scenario_guide + f"상품묘사: {parsed['product_name']}\n국가: {parsed['country']}\n가격: {price_display}\n수량: {parsed.get('quantity', 1)}\n\n{RESPONSE_MESSAGES['hs6_code_prediction_prompt']}\n" + '\n'.join([
266266
f"{i+1}. {c['description']} ({RESPONSE_MESSAGES['hs6_confidence']} {c['confidence']:.1%})" for i, c in enumerate(resp.hs6_candidates or [])
267-
]) + f"\n\n{RESPONSE_MESSAGES['hs6_code_selection_prompt']}\n예시: \"1번\", \"2번\", \"3번\""
267+
]) + f"\n\n{self.format_selection_guide('hs6_code_selection_prompt')}"
268268
self.state['responses'].append(response)
269269
return response
270270

@@ -279,6 +279,14 @@ def format_hs6_candidates(self) -> str:
279279
formatted += f"{i}. {candidate['code']} - {candidate['description']} ({RESPONSE_MESSAGES['hs6_confidence']} {candidate['confidence']:.1%})\n"
280280
return formatted
281281

282+
def format_selection_guide(self, selection_prompt_key: str) -> str:
283+
"""번호 선택 안내 + 예시 + 재예측 안내를 포맷팅합니다."""
284+
return (
285+
f"{RESPONSE_MESSAGES[selection_prompt_key]}\n"
286+
f"{RESPONSE_MESSAGES['number_example']}\n"
287+
f"{RESPONSE_MESSAGES['reprediction_guide']}"
288+
)
289+
282290
def handle_hs6_selection(self, user_input: str) -> str:
283291
from core.tariff_prediction.tools.parse_hs_results import parse_hs6_result
284292
from core.shared.utils.llm import get_llm
@@ -303,11 +311,11 @@ def handle_hs6_selection(self, user_input: str) -> str:
303311
self.state['current_step'] = STEPS['hs10_selection']
304312
response = f"{RESPONSE_MESSAGES['hs6_code_selected']} {selected['code']}\n\n{RESPONSE_MESSAGES['hs10_code_prediction_prompt']}\n" + '\n'.join([
305313
f"{i+1}. {c['code']} - {c['description']}" for i, c in enumerate(resp.hs10_candidates or [])
306-
]) + f"\n\n{RESPONSE_MESSAGES['hs10_code_selection_prompt']}\n예시: \"1번\", \"2번\", \"3번\""
314+
]) + f"\n\n{self.format_selection_guide('hs10_code_selection_prompt')}"
307315
self.state['responses'].append(response)
308316
return response
309317
else:
310-
response = f"{RESPONSE_MESSAGES['invalid_number']}\n\n{RESPONSE_MESSAGES['hs6_code_selection_prompt']}\n예시: \"1번\", \"2번\", \"3번\" 등"
318+
response = self.format_selection_guide('hs6_code_selection_prompt')
311319
self.state['responses'].append(response)
312320
return response
313321
else:
@@ -323,12 +331,12 @@ def handle_hs6_selection(self, user_input: str) -> str:
323331
if answer.lower() in ["네", "yes", "true", "1"]:
324332
return self._perform_hs6_reprediction(user_input)
325333
else:
326-
response = f"{RESPONSE_MESSAGES['hs6_code_selection_prompt']}\n예시: \"1번\", \"2번\", \"3번\"\n\n{RESPONSE_MESSAGES['hs6_code_reprediction_hint']}"
334+
response = self.format_selection_guide('hs6_code_selection_prompt')
327335
self.state['responses'].append(response)
328336
return response
329337

330338
except Exception:
331-
response = f"{RESPONSE_MESSAGES['input_processing_error']}\n{RESPONSE_MESSAGES['hs6_code_selection_prompt']}\n예시: \"1번\", \"2번\", \"3번\""
339+
response = f"{RESPONSE_MESSAGES['input_processing_error']}\n{self.format_selection_guide('hs6_code_selection_prompt')}"
332340
self.state['responses'].append(response)
333341
return response
334342

core/tariff_prediction/constants/constants.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -75,33 +75,14 @@
7575
DEFAULT_SHIPPING_COST = 0
7676
DEFAULT_SESSION_ID = "default_session"
7777

78-
# 입력 예시 상수
79-
INPUT_EXAMPLES = {
80-
'basic': [
81-
"미국에서 150만원에 노트북을 샀어요",
82-
"일본에서 10만원짜리 이어폰을 구매했어요",
83-
"독일에서 80만원에 운동화 2켤레를 샀어요"
84-
],
85-
'detailed': [
86-
"인텔 i7 노트북을 150만원에 미국에서 구매했어요"
87-
],
88-
'scenario': [
89-
"1번", "해외직구", "여행 중에 샀어요"
90-
],
91-
'selection': [
92-
"1번", "2번", "3번"
93-
]
94-
}
95-
9678
# 안내 메시지 상수
9779
GUIDE_MESSAGES = {
9880
'input_format': "💡 **다음과 같이 입력해 주세요:**",
9981
'select_number': "💡 **위 후보 중 하나를 선택해 주세요.**",
10082
'enter_number': "💡 **번호를 입력해 주세요.**",
10183
'wrong_number': "**잘못된 번호입니다.**",
10284
'number_range': "1부터 {max} 사이의 번호를 다시 입력해 주세요.",
103-
'number_example': "예시: \"1번\", \"2번\", \"3번\" 등",
104-
'reprediction_hint': "만약 후보가 모두 적합하지 않으면 '코드가 없다', '다시', '재예측' 등으로 입력해 주세요."
85+
'number_example': "예시: \"1번\", \"2번\", \"3번\" 등"
10586
}
10687

10788
# 오류 메시지 상수
@@ -212,7 +193,6 @@
212193
# HS10 선택 관련
213194
'hs10_no_reprediction': "💡 **번호를 입력해 주세요.** (예: 1, 2, 3)",
214195

215-
# 추가 누락된 키들
216196
'hs10_reprediction_not_available': "💡 **번호를 입력해 주세요.** (예: 1, 2, 3)",
217197
'off_topic_warning': "현재 관세 계산을 진행 중입니다. 계속 진행하시겠습니까, 아니면 중단하시겠습니까?\n\n계속하려면 '계속'을, 중단하려면 '중단'을 입력해 주세요.",
218198
'unrecognized_state': "죄송합니다. 현재 상태를 인식할 수 없습니다. 처음부터 다시 시작하겠습니다.",
@@ -249,7 +229,9 @@
249229
'tariff_note_1': "위 금액은 예상 관세이며, 실제 관세는 세관 심사 결과에 따라 달라질 수 있습니다.",
250230
'tariff_note_2': "정확한 관세는 통관 시 세관에서 최종 결정됩니다.",
251231
'tariff_note_3': "추가 문의사항이 있으시면 언제든 말씀해 주세요!",
252-
'previous_llm_response': "이전 LLM 응답:"
232+
'previous_llm_response': "이전 LLM 응답:",
233+
'number_example': '예시: "1번", "2번", "3번" 등',
234+
'reprediction_guide': '만약 모든 후보가 적합하지 않다면 “다시 예측해줘”라고 입력해 주세요.'
253235
}
254236

255237
# 상태 관련 상수

0 commit comments

Comments
 (0)