docs: Slack Lists 파일 첨부 해결 방안 구체화 및 100줄 이하 준수
This commit is contained in:
parent
932f54b83a
commit
34dd99d90c
@ -9,38 +9,47 @@
|
||||
|
||||
## 문제 상황
|
||||
|
||||
- coldmail_briefing.py:204: attachment 필드에 document_id 문자열 전달
|
||||
- Slack Lists API는 file_id 필요 (skill-slack/tests/test_slack_lists.py:112)
|
||||
- 전체 목표: IR PDF 분석 → 기업 평가 → 베이지안 확률 → Slack 보고서
|
||||
|
||||
---
|
||||
|
||||
## 선행 작업: 파일 영속성 문제 (해결 완료)
|
||||
**상세**: 251014_skill-rag-file_sshfs_allow_other_해결.md
|
||||
coldmail_briefing.py:207에서 document_id를 attachment에 전달하지만, Slack Lists API는 file_id 필요
|
||||
|
||||
---
|
||||
|
||||
## 현재 상태
|
||||
|
||||
- skill-rag-file: 업로드 API만 존재, 다운로드 API 없음
|
||||
- skill-slack: Lists API 존재, files_upload_v2 통합 없음
|
||||
- test_slack_lists.py:81-88, 112, 192: files_upload_v2 검증 완료
|
||||
- skill-rag-file/app/main.py:54-55: upload, search만 등록, download 없음
|
||||
- skill-slack/app/api/__init__.py:4: files import 없음
|
||||
|
||||
---
|
||||
|
||||
## 해결 방안
|
||||
|
||||
### 우선순위 1: skill-rag-file 다운로드 API
|
||||
- app/api/download.py (신규): GET /api/download/{document_id}
|
||||
- main.py:55: router 추가
|
||||
### 1단계: skill-rag-file 다운로드 API 추가
|
||||
**파일**: skill-rag-file/app/api/download.py (신규)
|
||||
**참고**: upload.py:80-87 (storage_path 생성 로직)
|
||||
**구현**:
|
||||
- `@router.get("/download/{document_id}")`: UUID로 문서 조회
|
||||
- DB에서 TeamDocument.storage_path 가져오기 (upload.py:108 참고)
|
||||
- `FileResponse(storage_path, media_type="application/pdf")` 반환
|
||||
**등록**: skill-rag-file/app/main.py:55 이후 추가
|
||||
- `app.include_router(download.router, prefix="/api", tags=["download"])`
|
||||
|
||||
### 우선순위 2: skill-slack 파일 업로드 API
|
||||
- app/api/endpoints/files.py (신규): POST /api/v1/files/upload
|
||||
- files_upload_v2 래핑, file_id 반환
|
||||
### 2단계: skill-slack 파일 업로드 API 추가
|
||||
**파일**: skill-slack/app/api/endpoints/files.py (신규)
|
||||
**참고**: lists.py:47-82 (엔드포인트 구조), slack_lists_service (서비스 패턴)
|
||||
**구현**:
|
||||
- `@router.post("/files/upload", dependencies=[Depends(verify_api_key)])`: UploadFile 받기
|
||||
- 파라미터: file (UploadFile), title (str), token (Optional[str])
|
||||
- WebClient(token).files_upload_v2(file=file.file, title=title) 호출
|
||||
- 반환: `{"file_id": str, "url_private": str}`
|
||||
**등록**: skill-slack/app/api/__init__.py 수정
|
||||
- 4번 줄: `from .endpoints import summary, digest, actions, messages, lists, files`
|
||||
- 13번 줄 이후: `router.include_router(files.router, tags=["Files"])`
|
||||
|
||||
### 우선순위 3: coldmail_briefing.py 통합
|
||||
- coldmail_briefing.py:159-204: document_id → file_id 변환
|
||||
- 다운로드 → 업로드 → attachment 필드에 [file_id] 전달
|
||||
### 3단계: coldmail_briefing.py 통합
|
||||
- coldmail_briefing.py:207 이전에 파일 변환 로직 추가:
|
||||
1. document_id → GET skill-rag-file/api/download/{document_id}
|
||||
2. 다운로드된 파일 → POST skill-slack/api/v1/files/upload
|
||||
3. file_id 받아서 attachment 필드에 전달
|
||||
- coldmail_briefing.py:207: `[f"document_{doc_id}"...]` → `[file_id]` 변경
|
||||
|
||||
---
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user