[feat] solution/backend: 카톡 대화에 홈페이지 목록·가게 고르기
실제로 붙여 보니 빠진 것이 드러났다 — 연결은 됐는데 **어느 홈페이지를 다루는 대화인지** 말해 주지 않았다. 가게가 하나면 말없이 자동 선택돼 더 모호했다. - 연결 직후 목록을 보여준다. 하나면 이름+발행 여부를, 여럿이면 바로가기 버튼으로 - 목록 줄에 발행 여부를 적는다 — 안 그러면 고친 것이 손님에게 보이는 줄 안다 - "목록"·"가게 바꿔줘" 로 언제든 돌아와 바꾼다. ★ 이 경로는 LLM 을 부르지 않는다: 대화가 막혔을 때 처음 찾는 길이라 늘 통해야 하고, 목록에 돈을 쓸 이유가 없다 - 사업장 목록이 아니라 list_my_sites 를 쓴다 — 사장님이 알아야 하는 건 "가게가 있다" 가 아니라 "발행돼 있나" 다(/sites 화면이 같은 이유로 그걸 쓴다) test_kakao_webhook.py 21 passed(목록·전환 4건 추가). 전체 845 passed / 53 failed — 53 은 이번 변경 전과 동일 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d32df10cf7
commit
1300652b09
4 files changed
+147
-22
No files matched your search
@@ -262,3 +262,59 @@ def test_바로가기는_열_개를_넘기지_않는다():
|
||||
assert len(out["template"]["quickReplies"]) == 10
|
||||
assert out["version"] == "2.0"
|
||||
assert out["template"]["outputs"][0]["simpleText"]["text"] == "안녕"
|
||||
|
||||
|
||||
# ── 사이트 목록 · 고르기 ─────────────────────────────────────────────────
|
||||
|
||||
async def test_연결되자마자_홈페이지_목록을_알려준다(client, auth_headers, db_engine):
|
||||
"""★ 연결만 알리고 끝내면 사장님은 **어느 홈페이지를 다루는 대화인지** 모른 채 말을 건다."""
|
||||
h, pid = await owner_with_place(client, auth_headers, "첫째가게")
|
||||
await client.post("/v1/place", headers=h, json={"name": "둘째가게", "category": 1})
|
||||
uid = await user_id_of(db_engine, pid)
|
||||
code = (await link_service.issue_code(uid))["code"]
|
||||
|
||||
res = await client.post(PATH, headers={"X-Agent-Secret": SECRET}, json=body(code, "목록-발화자"))
|
||||
text_out = said(res)
|
||||
assert "연결됐습니다" in text_out
|
||||
assert "첫째가게" in text_out and "둘째가게" in text_out
|
||||
# 바로 고를 수 있어야 한다 — 이름을 외워 치게 하지 않는다.
|
||||
assert set(quick(res)) == {"첫째가게", "둘째가게"}
|
||||
|
||||
|
||||
async def test_가게가_하나면_그_이름을_말해_준다(client, auth_headers, db_engine):
|
||||
h, pid = await owner_with_place(client, auth_headers, "혼자가게")
|
||||
uid = await user_id_of(db_engine, pid)
|
||||
code = (await link_service.issue_code(uid))["code"]
|
||||
res = await client.post(PATH, headers={"X-Agent-Secret": SECRET}, json=body(code, "하나-발화자"))
|
||||
assert "혼자가게" in said(res)
|
||||
assert "발행" in said(res) # 발행 여부를 같이 말한다
|
||||
|
||||
|
||||
async def test_목록이라고_하면_언제든_다시_보여주고_가게를_바꿀_수_있다(client, auth_headers, db_engine, monkeypatch):
|
||||
"""★ 대화가 막혔을 때 사장님이 처음 찾는 길이다. LLM 을 부르지 않는다."""
|
||||
speaker = "전환-발화자"
|
||||
h, _pid, _uid = await link(db_engine, client, auth_headers, speaker, "첫째가게")
|
||||
await client.post("/v1/place", headers=h, json={"name": "둘째가게", "category": 1})
|
||||
|
||||
called = AsyncMock()
|
||||
monkeypatch.setattr(runtime, "chat", called)
|
||||
|
||||
# 먼저 한 곳을 고른다.
|
||||
await client.post(PATH, headers={"X-Agent-Secret": SECRET}, json=body("첫째가게", speaker))
|
||||
# 목록으로 돌아온다.
|
||||
res = await client.post(PATH, headers={"X-Agent-Secret": SECRET}, json=body("가게 바꿔줘", speaker))
|
||||
assert "첫째가게" in said(res) and "둘째가게" in said(res)
|
||||
assert set(quick(res)) == {"첫째가게", "둘째가게"}
|
||||
called.assert_not_awaited() # 목록 보기에 모델을 부르지 않는다
|
||||
|
||||
# 다른 곳으로 바꾼다.
|
||||
picked = await client.post(PATH, headers={"X-Agent-Secret": SECRET}, json=body("둘째가게", speaker))
|
||||
assert "둘째가게" in said(picked)
|
||||
|
||||
|
||||
async def test_목록은_발행_여부를_같이_말한다(client, auth_headers, db_engine):
|
||||
"""★ 안 그러면 사장님은 고친 것이 손님에게 보이는 줄 안다."""
|
||||
speaker = "발행표시-발화자"
|
||||
await link(db_engine, client, auth_headers, speaker, "미발행가게")
|
||||
res = await client.post(PATH, headers={"X-Agent-Secret": SECRET}, json=body("목록", speaker))
|
||||
assert "아직 발행 전" in said(res)
|
||||
Reference in new issue
Block a user