Skip to content

feat: Discord /ingest content 파라미터 추가 및 /confirm_ingest 슬래시 커맨드 등록#245

Merged
seyoung4503 merged 9 commits into
CausalInferenceLab:masterfrom
thrcle:feat/discord-ingest-frontend
Jul 19, 2026
Merged

feat: Discord /ingest content 파라미터 추가 및 /confirm_ingest 슬래시 커맨드 등록#245
seyoung4503 merged 9 commits into
CausalInferenceLab:masterfrom
thrcle:feat/discord-ingest-frontend

Conversation

@thrcle

@thrcle thrcle commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

#️⃣ Issue Number

없음

📝 요약(Summary)

한 줄 요약: ingest → confirm 흐름을 Discord 슬래시 커맨드로 완성합니다.

해결하려는 문제

PR3(#243)에서 confirm_ingest 툴이 추가됐지만 Discord 프론트엔드에 연결되지 않아 사용자가 Discord에서 직접 호출할 방법이 없었습니다. 또한 기존 /ingest가 파일 ref만 받고 텍스트 직접 입력(content)을 지원하지 않아 Discord 환경에서 실용성이 낮았습니다.

이번 변경으로 달라지는 것

/ingest — content 파라미터 추가

# 기존: 서버에 파일이 있어야 사용 가능
/ingest ref:glossary.md

# 추가: Discord에서 텍스트 직접 입력
/ingest content:월매출은 SUM(orders.amount), 환불제외는 status != 'cancelled'

/confirm_ingest — 새 슬래시 커맨드

/confirm_ingest ref:<ref> accept:all layer:channel

ingest로 추출한 후보를 검토 후 시멘틱 레이어에 등록합니다.

완성된 Discord 사용 플로우

1. /ingest content:월매출은 SUM(orders.amount)이고, 활성고객은 30일 내 로그인한 users
   → 후보 목록 표시

2. /confirm_ingest ref:inline:xxxx accept:all layer:channel
   → ✅ 2 term(s) registered to [channel]

3. 월매출 기준 이번달 상위 고객 10명 보여줘
   → SQL 생성 + 실행

다음 PR과의 관계

PR1 → PR2 → PR3 → PR4 → PR5 (이 PR)

PR3(#243) 머지 후 순차 머지 부탁드립니다.

PR Checklist

  • 변경 사항에 대한 테스트 또는 검증 완료 (기존 151 passed 유지)
  • 로컬에서 정상 동작 확인
  • 관련 문서 업데이트 완료

thrcle and others added 9 commits July 18, 2026 16:07
Google OKF 스펙을 따라 KV 용어를 .md 파일로 내보내고
불러오는 OkfBundle 어댑터를 추가한다.

- adapters/storage/okf_bundle.py 신규: export/import, kind별 폴더 라우팅
- pyproject.toml: PyYAML 의존성 추가
- 신규 테스트 9개: 직렬화 단위, 폴더 구조, round-trip

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ingest_doc: 추출된 후보를 KV에 pending_ingest:{ref} 키로 임시 저장
- confirm_ingest: pending 후보를 FedEntry로 변환해 KV 등록 (all/인덱스 선택)
- OKF_BUNDLE_DIR env var 설정 시 confirm 후 OkfBundle로 자동 export
- HarnessContext.okf_bundle_dir 필드 추가 (ContextConcierge가 env에서 주입)
- 테스트 14개 신규 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- confirm_ingest: FedEntry 등록 성공 후 pending_ingest:{ref} 키 삭제
- ingest_doc: content 인라인 입력 시 ref를 md5 해시 기반으로 고유화
  ('inline' 고정 → 'inline:{md5[:8]}')하여 연속 ingestion 시 키 충돌 방지
- 테스트: pending 키 삭제 검증 케이스 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- _validate_layer 공통 함수 추출: layer 정규화, guild is_admin 체크,
  빈 channel_id 가드를 define/confirm_ingest 양쪽에서 공유
- okf_bundle: term에 /,\ 포함 시 path traversal 차단 + is_relative_to 가드
- okf_bundle: frontmatter 파싱을 split("\n---\n") 방식으로 교체해
  definition 본문에 --- 포함 시 조용히 유실되던 버그 수정
- 테스트: guild 비관리자, 빈 channel_id, 잘못된 layer 케이스 3개 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
_concept_path의 ValueError를 try/except 범위 안으로 포함해
악의적인 term 하나가 export 루프 전체를 중단시키지 않도록 수정

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- /ingest: ref(파일명) 외에 content(텍스트 직접 입력) 파라미터 지원
- /confirm_ingest: ingest 후보를 시멘틱 레이어에 등록하는 슬래시 커맨드 추가

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@seyoung4503 seyoung4503 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 좋습니다!!

@seyoung4503
seyoung4503 merged commit a797b30 into CausalInferenceLab:master Jul 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants