모든 프로젝트 1차 병합 .
This commit is contained in:
1 parent
b65de5a5f2
commit
c3d96fb7d3
4 files changed
+160
-9
No files matched your search
@@ -16,6 +16,12 @@ MAX_ROUNDS = 3
|
||||
_PRICE_MODES = ("price",)
|
||||
_CHOICE_MODES = ("yes_no", "confirm", "delivery_type")
|
||||
|
||||
# 최종 타결/결렬 스텝. 재협상=협상완료(우선협상 타결), 재견적=결과제출(투찰확정). 둘 다 협상실패=결렬.
|
||||
# 이 스텝들은 chat_end=False(뒤에 협상종료가 옴)라, outcome 을 컨텍스트에 적재했다가
|
||||
# 실제 종료(chat_end=협상종료) 시점에 확정 보고한다 → backend 가 chat_end 에서 DONE/REJECTED 를 옳게 가른다.
|
||||
_SUCCESS_STEPS = ("협상완료", "결과제출")
|
||||
_FAILURE_STEPS = ("협상실패",)
|
||||
|
||||
# 프론트는 표시용 문자열로 가격을 보낸다(예: "530,000원"). 천단위 콤마·통화기호("원")·공백 등
|
||||
# 숫자 외 문자를 제거하고 파싱한다. (콤마만 지우면 "원" 때문에 float() 가 실패해 가격 입력이
|
||||
# 영영 저장되지 않고 같은 step 에 머무는 버그가 났었다.)
|
||||
@@ -177,8 +183,16 @@ class ChatEngine:
|
||||
return self._error(session, f"다음 단계를 찾을 수 없습니다: {step_key}")
|
||||
node = self.scripts[step_key]
|
||||
session.step = step_key
|
||||
session.ended = bool(node.get("chat_end"))
|
||||
outcome = "success" if step_key == "협상완료" else "failure" if step_key == "협상실패" else None
|
||||
chat_end = bool(node.get("chat_end"))
|
||||
session.ended = chat_end
|
||||
# 최종 성공/실패를 통과 시점에 기록하고, 실제 종료(chat_end) 시점에만 outcome 으로 확정 보고.
|
||||
# (중간 성공/실패 스텝에서 보고하면 backend 종료확정 타이밍(chat_end)과 어긋나고,
|
||||
# ChatService 종료학습도 두 번 도는 문제가 생긴다.)
|
||||
if step_key in _SUCCESS_STEPS:
|
||||
session.context["final_outcome"] = "success"
|
||||
elif step_key in _FAILURE_STEPS:
|
||||
session.context["final_outcome"] = "failure"
|
||||
outcome = session.context.get("final_outcome") if chat_end else None
|
||||
return StepView(
|
||||
step=step_key,
|
||||
script=self.repo.format_script(node.get("script", ""), self._vars(session)),
|
||||
|
||||
Reference in new issue
Block a user