fix(editorial-chat): web→api-server only, ai-server gRPC (#446 fixup)#450
Merged
Conversation
#446 의 020001 (publish editorial_articles 생성) 이 020002 (drop staging) 보다 먼저 돌면서 staging 의 editorial_articles 가 살아있는 채로 publish 의 slug 컬럼 인덱스 만들려다 SQLSTATE 42703 (column does not exist) 로 실패. operation cloud 배포 시 발견. DROP TABLE IF EXISTS public.editorial_articles CASCADE 를 020001 시작 부분에 추가해서 idempotent 하게. 020002 의 동등 로직과 안전 중복. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…#446 fixup) PR #446 의 Stage 3 chat 이 web → ai-server (HTTP) 직접 호출로 구현돼서 모노레포 컨벤션 위반. ai-server 는 internal compute, web 은 항상 api-server 만 호출. Prod 배포 전에 같은 스코프 (#446) 안에서 fixup. 책임 분리: - api-server: chat session/message CRUD (assets DB), layout persist, admin 인증 게이팅 — 새 도메인 `domains/admin/editorial_article_chat`. - ai-server: 한 턴 LLM 실행 (Gemini + tool loop) — pure compute, gRPC `inbound.Queue/RunChatTurn`. DB 안 만짐. - web: 기존 admin proxy 패턴 (`API_BASE_URL` + Bearer token) 으로 통일. ai-server 정리: - editorial_article_chat/api.py 삭제 (HTTP router) - editorial_article_chat/repository.py 삭제 (DB layer) - agent.run_turn 시그니처 변경: (article_title, layout, history, user_text) → RunTurnResult (events list + final_layout + tool_calls_made + ...) - ToolExecutor 생성자에서 db 제거, persist_layout 삭제 - bootstrap.py 의 chat router include 제거 - MetadataServicer.RunChatTurn 신규: layout/history JSON 파싱 → run_turn → events_json + final_layout_json 직렬화 api-server 신규: - entities/assets_editorial_article_chat_{sessions,messages}.rs - domains/admin/editorial_article_chat.rs (4 handlers) - services/decoded_ai_grpc/client.rs::run_chat_turn (deadline 120s) - send_message 오케스트레이션: user msg INSERT → load article+history → gRPC RunChatTurn → events 순서대로 INSERT → layout UPDATE if changed → session.last_message_at touch web: - 2 chat route 가 AI_SERVER_HTTP_URL → API_BASE_URL + Bearer 로 교체 - server-env.ts 에서 AI_SERVER_HTTP_URL export 삭제 Streaming 은 out of scope (이번 PR 은 unary, send 클릭 후 ~30s 대기. 후속 streaming 은 #448 의 "대화형 강화"). prod ai.decoded.style 외부 노출 차단은 별도 SRE 작업 (이 PR 변경 후 web 이 더 이상 호출하지 않음). Local 검증: - cargo build OK - tsc --noEmit OK (chat 파일 clean) - gRPC RunChatTurn E2E: layout 'Test 매거진' → 'K-pop 가을 룩' 변경 확인, events_json sequence (assistant tool_call → tool result → assistant text) + layout_changed=True + final_layout 갱신. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
왜
PR #446 의 Stage 3 chat (대화형 매거진 편집) 이 web → ai-server (HTTP) 직접 호출로 구현돼서 모노레포 컨벤션 위반:
prod 적용 전에 (#446 의 기능 완성 PR 로) fixup.
변경
책임 분리
domains/admin/editorial_article_chat)RunChatTurn, stateless)proto
inbound.Queue.RunChatTurn(article_id, layout_json, history_json, user_message) → events_json + final_layout_json + final_text + ...ai-server
editorial_article_chat/api.py삭제 (HTTP router)editorial_article_chat/repository.py삭제 (DB layer)agent.run_turn시그니처 변경: pure compute (article_title + layout + history + user_text → RunTurnResult)ToolExecutor생성자에서 db 제거,persist_layout삭제bootstrap.py의 chat router include 제거MetadataServicer.RunChatTurn신규api-server (Rust)
assets_editorial_article_chat_{sessions,messages}(SeaORM)domains/admin/editorial_article_chat.rs(4 routes)GET/POST /sessions/{article_id}— 세션 list/createGET/POST /messages/{session_id}— 메시지 list/sendrun_chat_turn(deadline 120s)web
AI_SERVER_HTTP_URL→API_BASE_URL + Bearer패턴으로 (다른 admin proxy 와 동일)lib/server-env.ts의AI_SERVER_HTTP_URLexport 삭제마이그 픽스 (포함)
supabase/migrations/20260505020001_editorial_articles_published.sql의DROP TABLE IF EXISTS public.editorial_articles CASCADE;추가 (operation cloud 적용 도중 SQLSTATE 42703 로 실패한 순서 버그 수정)테스트
로컬
cargo build -p api-servercleantsc --noEmitclean (chat 파일)검증 권장 (web UI)
Out of scope
ai.decoded.style) 외부 차단 인프라 (별도 SRE) — 이 PR 변경으로 web 이 더 이상 호출하지 않음OPENAI_API_KEYprod 셋업 (feat(editorial): Stage 3 chat + assets 격리 + publish snapshot + thumbnail + commercial #446 PR 의 펜딩 —.env.backend.prod직접 추가 필요)Bump
bump:patch(architectural fix without user-facing API change. web ↔ api-server contract: 같은 4 endpoints, 다른 백엔드 구현. ai-server 외부 surface 삭제.)🤖 Generated with Claude Code