# 로컬 개발 — exdev AI 연동 로컬에서 **chatbotApi · chatbotApp · exAiChatBot · kakaoChatbotSkill · Qdrant · MongoDB** 를 실행하고, **LLM / Embedding / Reranker** 만 `chatbot.exdev.co.kr` Mac Studio 호스트 AI를 SSH 터널로 사용합니다. ## exdev AI 구조 | 포트 | 서비스 | API | |------|--------|-----| | 16000 | MLX LLM | `/v1/chat/completions` | | 16001 | Embedding (MPS) | `/embed` (`EMBED_API_STYLE=tei`) | | 16002 | Reranker | `/rerank` (`RERANK_API_STYLE=legacy`) | `https://chatbot.exdev.co.kr` 은 RAG API URL이며 LLM 직접 URL이 아닙니다. ## 한 번에 기동 / 중지 ```bash chmod +x local-dev/*.sh ./local-dev/stop-all.sh # 먼저 중지 ./local-dev/start-all.sh # 전체 기동 + 헬스체크 # 옵션 ./local-dev/start-all.sh --no-tunnel # AI 터널이 이미 떠 있을 때 ./local-dev/start-all.sh --skip-java # Docker(RAG + chatbotApp)만 ./local-dev/start-all.sh --no-build # RAG 이미지 빌드 생략 ./local-dev/stop-all.sh --mongo --tunnel # Mongo·SSH 터널까지 종료 ``` - RAG는 **`docker-compose.local.yml`** 사용 (Mac Docker `:28012` 포트 바인딩) - Qdrant 호스트 포트 **`6335`** (다른 프로젝트 `:6333` 과 충돌 방지) 기동 후 UI: `http://localhost:8089/chatbot/app/` --- ## 1. exdev AI 기동 (서버에서 한 번) exdev SSH 접속 후: ```bash bash /Users/aidev/dev/exAIChatbot2.0/scripts/exdev/start-host-ai.sh curl -s http://127.0.0.1:28012/health # llm/tei_embed/tei_rerank: true 확인 ``` ## 2. 로컬 SSH 터널 ```bash chmod +x local-dev/start-exdev-ai-tunnel.sh ./local-dev/start-exdev-ai-tunnel.sh ``` 터널 확인: ```bash curl -s http://127.0.0.1:16000/v1/models | head curl -s http://127.0.0.1:16001/health curl -s -X POST http://127.0.0.1:16002/rerank \ -H 'Content-Type: application/json' \ -d '{"query":"test","documents":["doc"]}' ``` ## 3. exAiChatBot .env ```bash cp local-dev/env.exdev-ai.template exAiChatBot-chatbot2.0-agent/.env cd exAiChatBot-chatbot2.0-agent docker compose -f docker-compose-slim.yml up -d curl -s http://localhost:28012/health ``` ## 4. Java 서비스 + chatbotApp ```bash # WAS cd chatbotApi-chatbot2.0-agent export INTERNAL_TOOL_API_KEY=local-dev-key export SKILL_INTERNAL_BASE_URL=http://127.0.0.1:8083 ./gradlew bootRun # Skill cd kakaoChatbotSkill-chatbot2.0-agent export AGENT_MODE=agent export RAG_AGENT_CHAT_URL=http://127.0.0.1:28012/agent/chat export CHATBOT_API_BASE_URL=http://127.0.0.1:8086/api/ export INTERNAL_TOOL_API_KEY=local-dev-key ./gradlew bootRun # UI cd chatbotApp-chatbot2.0-agent CHATBOT_API_UPSTREAM=http://host.docker.internal:8083/web/ \ CHATBOT_API_HOST=host.docker.internal ./start.sh ``` ## api_clients.py 스타일 변수 | 변수 | exdev 값 | 설명 | |------|----------|------| | `EMBED_API_STYLE` | `tei` | `/embed` | | `RERANK_API_STYLE` | `legacy` | `/rerank` | | `EMBED_API_STYLE` | `openai` | 게이트웨이 `/v1/embeddings` | | `RERANK_API_STYLE` | `gateway` | 게이트웨이 `/score` | 로컬 exdev 연동 시 **`tei` + `legacy`** 조합을 사용합니다.