- 7-8월 초기 구축 문서 12개를 _archive/troubleshooting/2025_07-08_initial_setup/로 이동 - book/300_architecture/390_human_in_the_loop_intent_learning.md를 journey/research/intent_classification/로 이동 (개발 여정 문서) - 빈 폴더 제거 (journey/assets/*)
94 lines
2.8 KiB
Markdown
94 lines
2.8 KiB
Markdown
# 로빙 명령어 구현 가이드
|
|
|
|
## 배경
|
|
- rb10408_test는 경량화 버전으로 명령어 미구현 상태
|
|
- rb10508_micro는 일부 명령어 구현됨
|
|
- 공통 명령어를 경량화를 유지하면서 구현해야 함
|
|
|
|
## 구현된 명령어 (rb10508_micro)
|
|
- `/memory` - 메모리 통계 조회
|
|
- `/digest` - 요약 생성
|
|
- `/news` - 뉴스 검색
|
|
- `/email` - 이메일 관련 기능
|
|
|
|
## 하이브리드 명령어 처리 아키텍처
|
|
|
|
### 1. 로컬 처리 명령어
|
|
빠른 응답이 필요하거나 로컬 데이터만 필요한 경우:
|
|
```python
|
|
# /memory - ChromaDB 직접 조회
|
|
async def _handle_memory(self, user_id: str) -> Dict[str, Any]:
|
|
memory_stats = await self.memory_manager.get_memory_stats()
|
|
return {"type": "memory_stats", "data": memory_stats}
|
|
|
|
# /help - 정적 응답
|
|
async def _handle_help(self) -> Dict[str, Any]:
|
|
return {"type": "help", "data": HELP_TEXT}
|
|
```
|
|
|
|
### 2. 외부 서비스 호출 명령어
|
|
복잡한 처리나 외부 데이터가 필요한 경우:
|
|
```python
|
|
# /news - News 스킬 서비스 호출
|
|
async def _handle_news(self, query: str) -> Dict[str, Any]:
|
|
return await self._call_external_service(
|
|
self.skill_endpoints["news"],
|
|
{"query": query}
|
|
)
|
|
|
|
# /digest - Slack 스킬 서비스 호출
|
|
async def _handle_digest(self, channel: str) -> Dict[str, Any]:
|
|
return await self._call_external_service(
|
|
self.skill_endpoints["slack"] + "/digest",
|
|
{"channel": channel}
|
|
)
|
|
```
|
|
|
|
### 3. 명령어 라우팅 구조
|
|
```python
|
|
class CommandHandler:
|
|
def __init__(self):
|
|
self.local_commands = {
|
|
"/help": self._handle_help,
|
|
"/stats": self._handle_stats,
|
|
"/memory": self._handle_memory
|
|
}
|
|
|
|
self.external_commands = {
|
|
"/news": ("news", self._handle_news),
|
|
"/digest": ("slack", self._handle_digest),
|
|
"/email": ("email", self._handle_email)
|
|
}
|
|
```
|
|
|
|
## 구현 시 고려사항
|
|
|
|
### 1. 메모리 효율성
|
|
- 로컬 명령어는 최소한의 메모리 사용
|
|
- 캐싱은 필요시에만 선택적 적용
|
|
|
|
### 2. 응답 속도
|
|
- 로컬 명령어: < 100ms
|
|
- 외부 서비스: Slack 3초 룰 준수
|
|
|
|
### 3. 에러 처리
|
|
```python
|
|
try:
|
|
result = await handler(params)
|
|
except ServiceUnavailable:
|
|
return {"error": "서비스를 일시적으로 사용할 수 없습니다."}
|
|
except Exception as e:
|
|
logger.error(f"Command error: {e}")
|
|
return {"error": "명령어 처리 중 오류가 발생했습니다."}
|
|
```
|
|
|
|
## 추가 구현 필요 명령어
|
|
- `/remind` - 리마인더 설정
|
|
- `/search` - 메모리 검색
|
|
- `/report` - 일일/주간 리포트
|
|
|
|
## 관련 파일
|
|
- `/home/heejae/rb10408_test/app/commands/handler.py` (생성 필요)
|
|
- `/home/heejae/rb10508_micro/app/commands/` (참고용)
|
|
- `/home/heejae/DOCS/skills-and-commands.md`
|