[feat] solution/backend: 에이전트가 사진을 내리고 대표를 지정한다
사진 쪽은 MediaService 에 list_media 하나뿐이었다 — 쓰기 경로가 아예 없었고
빌더 화면에서도 보기만 됐다. 서비스·라우터부터 열고 도구를 붙였다.
- crud: set_sort_order / service: hide_media · set_primary
- POST .../media/{id}/hide · /primary — ★ 에이전트 전용 뒷문을 만들지 않는다.
그러면 빌더 화면이 그 기능을 못 쓰고 나중에 붙일 때 로직이 두 벌이 된다
- 도구 셋: list_photos(READ) · hide_photo · set_primary_photo(REVERSIBLE)
★ 대표 사진에 별도 칸을 두지 않았다. primary_media 가 '첫 장' 을 쓰고 목록이
ORDER BY sort_order 라, 지정은 sort_order 를 가장 작게 내리는 일이다 —
칸을 따로 두면 규칙이 둘이 되어 검색 결과의 그림과 화면 첫 장이 갈린다.
★ 내려도 지우지 않는다(REJECTED). origin_url·source_type 이 남아야 재게시
권리(DECISIONS 1-2) 결론이 났을 때 되짚을 수 있다.
★★ 업로드·교체는 만들지 않았다 — 미결 사항을 코드가 먼저 푸는 자리다.
테스트가 레지스트리에 upload·replace 가 없는지 실제로 검사한다.
test_agent_runtime 32 passed(사진 6건 추가).
전체 871 passed / 53 failed — 53 은 이번 변경 전과 동일. npm run lint 통과
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ea9ae1ac2a
commit
af6e3799eb
9 files changed
+394
-6
No files matched your search
@@ -82,7 +82,7 @@ async def _context_facts(user: UserInfo, place_id: str, place) -> list[dict]:
|
||||
return out[:30]
|
||||
|
||||
|
||||
async def _choose(place, fields, facts, sections, message) -> dict:
|
||||
async def _choose(place, fields, facts, sections, photos, message) -> dict:
|
||||
"""LLM 한 번. 고른 도구 이름과 인자만 받는다."""
|
||||
active = provider.active()
|
||||
async with httpx.AsyncClient(timeout=REQUEST_TIMEOUT) as client:
|
||||
@@ -95,6 +95,7 @@ async def _choose(place, fields, facts, sections, message) -> dict:
|
||||
fields=fields,
|
||||
facts=facts,
|
||||
sections=sections,
|
||||
photos=photos,
|
||||
message=message,
|
||||
),
|
||||
response_schema=prompt.RESPONSE_SCHEMA,
|
||||
@@ -132,11 +133,13 @@ async def chat(user: UserInfo, place_id: str, message: str, confirm: dict | None
|
||||
facts = await _context_facts(user, place_id, place)
|
||||
# ★ 섹션은 이름으로 지목한다("후기 빼줘"). 목록을 안 실으면 모델이 이름을 지어낸다.
|
||||
sections, _theme = await registry.sections_of(ctx)
|
||||
# ★ 사진도 이름으로 지목한다. 목록을 안 실으면 모델이 라벨을 지어낸다.
|
||||
photos = await registry.photo_names(ctx)
|
||||
# ★ 사이트 상태는 프롬프트에 싣지 않는다. 그 한 줄 때문에 매 턴 사이트 조회 + 슬러그 계산이
|
||||
# 돌았고, 정작 모델이 필요할 때는 `get_site_status` 도구를 부르면 된다.
|
||||
|
||||
try:
|
||||
choice = await _choose(place, fields, facts, sections, message)
|
||||
choice = await _choose(place, fields, facts, sections, photos, message)
|
||||
except LlmError as ex:
|
||||
LOG.w(f"[agent] 도구 선택 실패: {type(ex).__name__}")
|
||||
raise AgentError("AGENT_CALL_FAILED") from ex
|
||||
|
||||
Reference in new issue
Block a user