Skip to content

UG/FE 대화 thread 영속화 + 다중 채팅 UI — 리프레시 복구 + 새 채팅 / 이력 관리 #70

@hagyutae

Description

@hagyutae

배경

#39 (PR #68) 검증 중 두 가지 UI/persistence 결함 확인:

  1. 페이지 리프레시하면 대화 내역 전부 손실 — placeholder ("메시지를 입력해
    Primary 와 대화해 보세요.") 만 뜸. context_id 도 휘발 → 같은 thread
    이어가지 못함.
  2. 사용자가 conversation 을 명시 분리 / 관리할 UI 없음. 한 탭에서 새 주제로
    넘어가도 같은 context 로 누적되어 LLM 이 무관 history 까지 끌고 옴.

누락 지점

A. UG 측 — history endpoint 미구현

user-gateway/src/user_gateway/routes.py 의 endpoint 가 /healthz,
/api/agent-card, /api/chat 셋뿐. context_id 로 과거 메시지를
조회할 endpoint 가 없음.

B. FE 측 — contextId 영속화 / history 로드 / 다중 thread UI 부재

user-gateway/frontend/src/components/Chat.tsx:

const [contextId, setContextId] = useState<string | null>(null);  // 휘발성
const [messages, setMessages] = useState<ChatMessage[]>([]);       // 빈 배열로 시작
  • contextId 가 React state 만 — reload / 새 탭 시 사라짐.
  • 페이지 로드 시 history 조회 effect 가 없어 항상 빈 상태.
  • "새 채팅" 액션 / 과거 대화 목록 / context 전환 UI 없음 → 사용자가 명시
    새 주제 시작 / 이전 대화 복귀 불가.

C. 회수 가능 / 회수 불가 데이터

회수 가능 (DB 어딘가 남아 있음):

  • dev_team.agent_items — 사용자 발화 + 정상 종료된 turn 의 agent 발화
  • langgraph.checkpoints — graph state (LangChain message history)

회수 불가 (영구 손실):

본 이슈에선 회수 가능한 데이터를 UI 에 복구. 회수 불가 부분은 #69 영역.

작업 plan

UG

  • GET /api/contexts — 현재 사용자의 contextId 목록 (created_at / topic / 마지막 발화 미리보기 정도)
  • GET /api/history?context_id=<uuid> — 해당 thread 의 메시지 시간순 목록
  • 응답 형식: {messages: [{role: 'user'|'agent', text, message_id?, created_at}, ...]}
  • 데이터 출처: Doc Store MCPagent_sessions.list + agent_items.list
    (Doc Store 가 conversation single source of truth — proposal §2.5)

FE

  • contextId 영속화localStorage.setItem("activeContextId", id) 저장,
    페이지 로드 시 복원
  • 활성 thread 의 history hydrate — 로드 시 GET /api/history 호출 후
    messages state 에 채움
  • 다중 chat UI — 사이드바 / 드롭다운에 contextId 목록 (제목 = 첫 user 발화 정도):
    • "새 채팅" 버튼: 활성 contextId 를 null 로 reset → 다음 발화 시 UG 가 새 발급
    • 목록 항목 클릭: 활성 contextId 전환 + history 재로드
    • (선택) 채팅 제목 rename / 삭제 — M3 안에선 minimal UI 면 충분

영향 / 우선순위

관련

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions