[feat] agent: 협상 고도화 — LLM 표현/이해층 + 카드 전술 실행계층 + ktcommerce 정리

카드 재설계("멘트 카드 → 전술 카드"):
- tactics.py 신설: 카드번호→전술(카운터 산식) 레지스트리, min(counter,target) 클램프
- 카운터 수락=즉시 타결(pending_counter_price 일반화, 구 offer_1pct 흡수)
- 목표가 초과 타결 금지(성공스텝 진입 가드) + "카드 소진=실패" 폐지→종결 국면
- 선택형 와일드카드(WC-*) 발동 + card.wild_cards 멘트 DB 어댑터

LLM 계층:
- Phase 2 표현층 ScriptNaturalizer(카드 멘트 자연화, 마커·치환자·숫자 보존 검증)
- Phase 3 이해층 InputInterpreter(자유발화 NLU→기대입력, 한국어 가격 파서)
- OPENAI_API_KEY env override(server_configs) + 전역 자격증명 게이트

결정 스택(Phase 1):
- 협상 규칙 데이터화(negotiation.wildcard_*_ratio/max_counter_rounds)
- 선택카드 우선순위 prior(UCB 방문수 감쇠, Q-table 오염 없음)

버그픽스:
- 인하율 음수 표기 제거 + 인상/동일/인하 구분(discount_phrase)
- 자연화 강조마커 보존(볼드/색 소실 시 원본 폴백)
- 카드 시드 가격변수(prev_partner_price·target_mid_price·middle_price 등) 치환

정리:
- ktcommerce 테넌트 삭제 + 테스트 21파일 imarketkorea/_base 로 마이그레이션
- 실 LLM 호출 차단 conftest 가드

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
HyeongBaeYangandClaude Fable 5 committed 2026-07-10 13:37:36 +09:00
1 parent b368a19f79
commit 1682481b01
46 files changed
+2091 -240

No files matched your search

@@ -5,7 +5,9 @@
"editor_script_id": "시작",
"next_input_mode": "null",
"input_options": [],
"next_step": { "default": "서비스안내" },
"next_step": {
"default": "서비스안내"
},
"type": "null",
"chat_end": false
},
@@ -13,8 +15,12 @@
"script": "안녕하세요. {company_name} {service_name}입니다. 본 서비스는 {company_name}와 협력사 간 물품 공급 가격 협상을 위한 것으로, 귀사가 공급 중인 품목의 새로운 가격 협상을 진행합니다. 안내 사항을 확인하신 뒤, 다음 단계로 넘어가려면 [확인]을 눌러 주세요.",
"editor_script_id": "서비스안내",
"next_input_mode": "confirm",
"input_options": ["확인"],
"next_step": { "default": "담당자확인" },
"input_options": [
"확인"
],
"next_step": {
"default": "담당자확인"
},
"type": "text",
"chat_end": false
},
@@ -22,8 +28,14 @@
"script": "본 안내는 협력사 포털에 등록된 담당자에게 발송되었습니다. 구매 협상 담당자가 맞는지 다시 한 번 확인 부탁드립니다. 담당자가 맞다면 [예], 맞지 않다면 [아니오]를 선택해 주세요.",
"editor_script_id": "담당자확인",
"next_input_mode": "yes_no",
"input_options": ["예", "아니오"],
"next_step": { "예": "협상품목안내", "아니오": "담당자확인_아니오" },
"input_options": [
"예",
"아니오"
],
"next_step": {
"예": "협상품목안내",
"아니오": "담당자확인_아니오"
},
"type": "text",
"chat_end": false
},
@@ -31,8 +43,14 @@
"script": "[아니오]를 선택하셨습니다. 담당자가 변경되어 정보를 수정하시려면 [정보변경]을, 실수로 선택하신 경우 다시 진행하려면 [돌아가기]를 선택해 주세요.",
"editor_script_id": "담당자확인_아니오",
"next_input_mode": "yes_no",
"input_options": ["돌아가기", "정보변경"],
"next_step": { "돌아가기": "담당자확인", "정보변경": "정보변경_완료" },
"input_options": [
"돌아가기",
"정보변경"
],
"next_step": {
"돌아가기": "담당자확인",
"정보변경": "정보변경_완료"
},
"type": "text",
"chat_end": false
},
@@ -49,8 +67,12 @@
"script": "{company_name}는 귀사의 협력에 진심으로 감사드립니다. 이번 가격 협상 품목과 기본 정보를 안내드립니다. 좌측의 상품 정보를 확인해 주세요. 협상이 원만히 마무리되면 더 많은 협력 기회가 마련될 수 있습니다.",
"editor_script_id": "협상품목안내",
"next_input_mode": "confirm",
"input_options": ["확인"],
"next_step": { "확인": "기존가격제시" },
"input_options": [
"확인"
],
"next_step": {
"확인": "기존가격제시"
},
"type": "text",
"chat_end": false
},
@@ -59,7 +81,9 @@
"editor_script_id": "기존가격제시",
"next_input_mode": "price",
"input_options": [],
"next_step": { "default": "가격협상_확인" },
"next_step": {
"default": "가격협상_확인"
},
"type": "text",
"chat_end": false
},
@@ -68,22 +92,42 @@
"editor_script_id": "가격협상_재입력",
"next_input_mode": "price",
"input_options": [],
"next_step": { "default": "가격협상_확인" },
"next_step": {
"default": "가격협상_확인"
},
"type": "text",
"chat_end": false
},
"가격협상_확인": {
"script": "제시하신 가격은 **{input_price}원**으로, 기존 공급가 대비 약 **{discount_rate}%** 인하된 금액입니다. 이 금액으로 제안하시겠습니까? 수정하시려면 [아니오]를 선택해 주세요.",
"script": "제시하신 가격은 **{input_price}원**입니다. {discount_phrase}이 금액으로 제안하시겠습니까? 수정하시려면 [아니오]를 선택해 주세요.",
"editor_script_id": "가격협상_확인",
"next_input_mode": "yes_no",
"input_options": ["예", "아니오"],
"input_options": [
"예",
"아니오"
],
"next_step": {
"예": [
{ "condition": "check_wildcard_entry", "next": "가격협상_와일드" },
{ "condition": "check_is_supplier_type_c", "next": "협상완료" },
{ "condition": "check_price_match", "next": "협상완료" },
{ "condition": "check_iteration_limit", "next": "협상실패" },
{ "condition": "default", "next": "가격협상" }
{
"condition": "check_wildcard_entry",
"next": "가격협상_와일드"
},
{
"condition": "check_is_supplier_type_c",
"next": "협상완료"
},
{
"condition": "check_price_match",
"next": "협상완료"
},
{
"condition": "check_iteration_limit",
"next": "협상실패"
},
{
"condition": "default",
"next": "가격협상"
}
],
"아니오": "가격협상_재입력"
},
@@ -94,8 +138,14 @@
"script": "제시하신 금액은 **{input_price}원**입니다. 이 금액으로 견적을 제출하시겠습니까? 수정하시려면 [아니오]를 선택해 주세요.",
"editor_script_id": "가격협상_확인_버짓",
"next_input_mode": "yes_no",
"input_options": ["예", "아니오"],
"next_step": { "예": "협상완료", "아니오": "가격협상_재입력" },
"input_options": [
"예",
"아니오"
],
"next_step": {
"예": "협상완료",
"아니오": "가격협상_재입력"
},
"type": "text",
"chat_end": false
},
@@ -104,7 +154,9 @@
"editor_script_id": "가격협상",
"next_input_mode": "price",
"input_options": [],
"next_step": { "default": "가격협상_확인" },
"next_step": {
"default": "가격협상_확인"
},
"type": "text",
"chat_end": false
},
@@ -112,8 +164,12 @@
"script": "협조해 주신 덕분에 원만히 협상이 완료되었습니다. 협상 결과를 확인하신 뒤 동의해 주세요. 거래 약정에 따라 일부 조건이 조정될 수 있는 점 참고 부탁드립니다. 성실히 응해 주셔서 감사합니다.",
"editor_script_id": "협상완료",
"next_input_mode": "confirm",
"input_options": ["협상 내용을 확인했으며, 이의가 없음에 동의합니다."],
"next_step": { "default": "협상종료" },
"input_options": [
"협상 내용을 확인했으며, 이의가 없음에 동의합니다."
],
"next_step": {
"default": "협상종료"
},
"type": "text",
"chat_end": false
},
@@ -122,7 +178,9 @@
"editor_script_id": "협상실패",
"next_input_mode": "null",
"input_options": [],
"next_step": { "default": "협상종료" },
"next_step": {
"default": "협상종료"
},
"type": "text",
"chat_end": false
},
@@ -134,5 +192,21 @@
"next_step": null,
"type": "text",
"chat_end": true
},
"가격협상_카운터": {
"script": "제시해 주신 **{input_price}원** 검토했습니다. 저희는 **{counter_price}원**을 제안드립니다. 이 가격으로 진행 가능하시면 '수락'을, 어려우시면 '다른 가격 제시'를 선택해 주세요.",
"editor_script_id": "가격협상_카운터",
"next_input_mode": "yes_no",
"input_options": [
"수락",
"다른 가격 제시"
],
"next_step": {
"수락": "협상완료",
"다른 가격 제시": "가격협상_재입력",
"default": "가격협상_재입력"
},
"type": "text",
"chat_end": false
}
}
}