docs: Slack/Frontend 채널별 메모리 분리 문제 추가

- 동일 사용자(happybell80)가 채널별로 다른 컬렉션 사용 문제 명시
- Slack: rb10508_test_happybell80_episodic
- Frontend: rb10508_test_default_episodic
- 통합 해결 방안 3가지 우선순위별 정리
- Auth 서버 JWT 활용 방안을 최우선 권장
This commit is contained in:
happybell80 2025-08-16 12:09:54 +09:00
parent 2e8ac8d959
commit 2453b61d5f

View File

@ -111,10 +111,14 @@ collection_name = f"{settings.ROBING_ID}_{username if username else 'default'}_{
- Robing Gateway가 JWT 토큰을 검증하지 않음
- X-User-Id 헤더만 확인 (누구나 위조 가능)
### 3. 사용자 식별 실패 ⚠️
### 3. 사용자 식별 실패 및 채널별 메모리 분리 ⚠️
- endpoints.py에서 username 파라미터를 storage.py로 전달하지 않음
- user_id는 받지만 username으로 변환하지 않음
- ChromaDB 컬렉션을 모든 사용자가 공유 (rb10508_test_default_episodic)
- **채널별 다른 컬렉션 사용 문제**:
- Slack: `rb10508_test_happybell80_episodic` (Auth 서버 매핑 제공)
- Frontend: `rb10508_test_default_episodic` (모든 사용자 공유)
- **동일 사용자(happybell80)가 두 채널에서 다른 메모리 공간 사용**
- 대화 내용 분리로 연속성 상실
### 4. 이메일-유저명 매핑 하드코딩 📝
- 새 사용자 추가 시 코드 수정 필요
@ -266,7 +270,33 @@ X-Username: happybell80 // 명확한 이름
## 즉시 수정 필요 (Critical)
### 1. ~~Frontend (robing-api.ts)~~ ✅ 완료
### 통합 해결 방안 (우선순위별)
#### 1. Auth 서버 JWT 활용 (권장) 🌟
```
Frontend 로그인 → JWT(username 포함) → Gateway 검증 → Robing username 추출
→ Slack과 동일한 컬렉션 사용 (rb10508_test_happybell80_episodic)
```
#### 2. Frontend user_id 전달 개선
```
로그인 후 username을 user_id로 전송
현재: user_id = "default_user"
개선: user_id = "happybell80"
```
#### 3. 통합 매핑 테이블 구축
```
Auth 서버에 통합 매핑:
email ↔ slack_id ↔ username
- Frontend: email → username
- Slack: slack_id → username
- 결과: 동일 username으로 통합 메모리
```
### 개별 수정 사항
#### 1. ~~Frontend (robing-api.ts)~~ ✅ 완료
```typescript
// 수정 완료 - robing-api.ts:38-41
if (token) {
@ -274,7 +304,7 @@ if (token) {
}
```
### 2. Gateway (main.py)
#### 2. Gateway (main.py)
```python
# JWT 검증 추가
from app.core.auth import decode_access_token
@ -286,7 +316,7 @@ if authorization:
username = payload.get("sub") # 또는 username
```
### 3. Robing Service (rb10508_micro)
#### 3. Robing Service (rb10508_micro)
```python
# endpoints.py 수정 필요:
# 1. JWT 토큰에서 username 추출