[chore] solution/backend,frontend: 에이전트 화면 보류 — 설정으로 닫고 코드는 남긴다
카카오톡 채널 개설이 법인폰 본인인증에 걸려 보류됐다. 채널이 없으면 대화창은 사장님에게 **어디에도 닿지 않는 입구**이고, 열려 있으면 "되는 기능" 으로 오해한다. - config/agent_config: AGENT_CHAT_ENABLED 신설(기본 0) - runtime.is_configured(): 스위치와 LLM 키를 둘 다 본다 — 화면을 우회해 API 를 직접 불러도 AGENT_NOT_CONFIGURED 다 - AgentChatDock · KakaoChannelCard: 조건 미충족이면 통째로 감춘다(return null). 연결 카드는 connection_enabled 가 기준이라 설정만 채우면 그대로 다시 나타난다 - ★ 코드를 지우지 않았다 — 되돌릴 때 커밋을 되짚지 않고 값 둘만 채우면 된다 ★ Threads 카드와 판단이 갈린 것이 맞다. 저쪽은 사장님이 곧 쓸 수 있는 기능이라 자리를 두고 버튼만 죽였고, 이쪽은 언제 열릴지 말해 줄 수 없다. test_agent_runtime(스위치 2건 추가)·test_kakao_link 34 passed. npm run lint 통과 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
59df616a7b
commit
a553e41197
11 files changed
+275
-21
No files matched your search
@@ -23,11 +23,20 @@ class AgentConfig(BaseSettings):
|
||||
# 코드가 짧아서(사람이 손으로 친다) 무차별 대입이 가능하다. 시도 수로 끊는다.
|
||||
KAKAO_LINK_MAX_ATTEMPTS: int = 5
|
||||
|
||||
# ★ 기본 꺼짐. 카카오톡 채널 개설이 법인폰 본인인증에 걸려 보류됐고(2026-09-21),
|
||||
# 채널 없이 대화창만 띄우면 사장님에게는 **어디에도 닿지 않는 입구**가 된다.
|
||||
# 코드는 그대로 두고 이 값으로만 연다 — 되돌릴 때 커밋을 되짚지 않아도 된다.
|
||||
AGENT_CHAT_ENABLED: str = "0"
|
||||
|
||||
|
||||
def get(name, default=""):
|
||||
return getattr(AgentConfig(), name, default) or default
|
||||
|
||||
|
||||
def chat_enabled() -> bool:
|
||||
return get("AGENT_CHAT_ENABLED", "0") == "1"
|
||||
|
||||
|
||||
def kakao_link_enabled() -> bool:
|
||||
return bool(get("KAKAO_CHANNEL_PUBLIC_ID"))
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ from common.enums import DBWRType, ErrorType, PlaceCategory
|
||||
from common.database.db_session_manager import DB_SESSION_MNG
|
||||
from common.database.model.models import places
|
||||
from common.models.gmodel import UserInfo
|
||||
from config import agent_config as config
|
||||
from config.server_configs import external_api_config
|
||||
from crud.fact_crud import FactCRUD
|
||||
from crud.place_crud import PlaceCRUD
|
||||
@@ -42,7 +43,14 @@ class AgentError(RuntimeError):
|
||||
|
||||
|
||||
def is_configured() -> bool:
|
||||
return provider.active().is_configured()
|
||||
"""대화창을 열 수 있나 — 스위치와 LLM 키를 **둘 다** 본다.
|
||||
|
||||
★ `AGENT_CHAT_ENABLED` 가 기본 꺼짐이다(config/agent_config). 카카오톡 채널이 준비되기
|
||||
전에는 대화창을 띄우지 않는다 — 코드는 다 있지만 사장님 입장에서는 어디에도 닿지 않는
|
||||
입구이고, 열려 있으면 "되는 기능" 으로 오해한다.
|
||||
이건 Threads 카드처럼 '자리는 두고 버튼만 죽이는' 경우와 다르다. 저쪽은 사장님이
|
||||
**곧 쓸 수 있는** 기능이라 존재를 알려야 했고, 이쪽은 아직 제품이 아니다."""
|
||||
return config.chat_enabled() and provider.active().is_configured()
|
||||
|
||||
|
||||
async def _load_place(user: UserInfo, place_id: str):
|
||||
|
||||
@@ -26,6 +26,7 @@ def choose(monkeypatch):
|
||||
def _set(payload):
|
||||
monkeypatch.setattr(runtime, "_choose", AsyncMock(return_value=payload))
|
||||
|
||||
monkeypatch.setenv("AGENT_CHAT_ENABLED", "1")
|
||||
monkeypatch.setattr(runtime, "is_configured", lambda: True)
|
||||
return _set
|
||||
|
||||
@@ -222,3 +223,26 @@ def test_읽기_도구는_확인을_요구하지_않는다():
|
||||
assert tools.REGISTRY["set_fact"].grade == ToolGrade.REVERSIBLE
|
||||
assert tools.REGISTRY["publish"].grade == ToolGrade.SEMI
|
||||
assert tools.REGISTRY["publish"].confirm
|
||||
|
||||
|
||||
# ── 보류 스위치 ─────────────────────────────────────────────────────────
|
||||
|
||||
def test_스위치가_꺼져_있으면_키가_있어도_안_열린다(monkeypatch):
|
||||
"""★ 기본이 꺼짐이다. 카카오톡 채널이 준비되기 전에는 대화창을 띄우지 않는다 —
|
||||
코드는 다 있지만 사장님에게는 어디에도 닿지 않는 입구다."""
|
||||
monkeypatch.setattr(runtime.provider, "active", lambda: SimpleNamespace(is_configured=lambda: True))
|
||||
monkeypatch.delenv("AGENT_CHAT_ENABLED", raising=False)
|
||||
assert runtime.is_configured() is False
|
||||
monkeypatch.setenv("AGENT_CHAT_ENABLED", "1")
|
||||
assert runtime.is_configured() is True
|
||||
monkeypatch.setenv("AGENT_CHAT_ENABLED", "0")
|
||||
assert runtime.is_configured() is False
|
||||
|
||||
|
||||
async def test_꺼진_동안_대화_요청은_거절된다(client, auth_headers, monkeypatch, db_engine):
|
||||
monkeypatch.delenv("AGENT_CHAT_ENABLED", raising=False)
|
||||
h, pid = await seed(client, auth_headers)
|
||||
res = await client.post(f"/v1/agent/chat/{pid}", headers=h, json={"message": "안녕"})
|
||||
assert res.status_code == 409
|
||||
assert res.json()["detail"] == "AGENT_NOT_CONFIGURED"
|
||||
assert (await client.get("/v1/agent/status", headers=h)).json()["enabled"] is False
|
||||
Reference in new issue
Block a user