AI ๊ธฐ๋ฐ ๊ณ ๊ฐ ์๋น์ค ์ ๋ฌด ์๋ฎฌ๋ ์ดํฐ์ ๋๋ค. ์ ์ ์ง์์ ์ํ ๊ณ ๊ฐ ์๋ ์ฐ์ต ๋๊ตฌ๋ก, ์ค์ ์ ๋ฌด ๋งค๋ด์ผ์ ํ์ตํ AI์ ๋ค์ํ ์ํฉ์ ์๋ฎฌ๋ ์ด์ ํ ์ ์์ต๋๋ค.
์์ฐ์์ : https://www.youtube.com/watch?v=9wFu5BvlJm8&feature=youtu.be
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ โ โ โ โ
โ Frontend โโโโโโถโ Backend โโโโโโถโ AI Service โ
โ (React) โ โ (NestJS) โ โ (FastAPI) โ
โ :5173/:80 โ โ :3001 โ โ :8000 โ
โ โ โ โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ MySQL โ โ ChromaDB โ
โ (TypeORM) โ โ (Vector DB) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
PWS_V3/
โโโ frontend/ # React ํ๋ก ํธ์๋ (Vite + TypeScript)
โ โโโ src/
โ โ โโโ components/ # UI ์ปดํฌ๋ํธ
โ โ โโโ services/ # API ์๋น์ค
โ โ โโโ types/ # TypeScript ํ์
โ โโโ package.json
โ
โโโ backend/ # NestJS ๋ฐฑ์๋
โ โโโ src/
โ โ โโโ auth/ # ์ธ์ฆ ๋ชจ๋ (JWT)
โ โ โโโ projects/ # ํ๋ก์ ํธ ๋ชจ๋
โ โ โโโ conversations/# ๋ํ ๋ชจ๋
โ โ โโโ messages/ # ๋ฉ์์ง ๋ชจ๋
โ โ โโโ files/ # ํ์ผ ๋ชจ๋
โ โ โโโ ai/ # AI ํ๋ก์ ๋ชจ๋
โ โโโ package.json
โ
โโโ ai/ # FastAPI AI ์๋น์ค
โโโ main.py # FastAPI ๋ฉ์ธ
โโโ requirements.txt
- ํ๋ก์ ํธ๋ณ ๋งค๋ด์ผ ์ ๋ก๋ ๋ฐ ๊ด๋ฆฌ
- ์ ๋ฌด ์ง์นจ ์ค์
- ํ์ผ ์๋ฒ ๋ฉ (PDF, TXT, Excel, Word)
- ๊ณ ๊ฐ ์ญํ : AI ์ง์๊ณผ ๋ํํ๋ฉฐ ์๋น์ค ์ฒดํ
- ์ง์ ์ญํ : AI ๊ณ ๊ฐ์ ๋ฌธ์์ ์๋ ์ฐ์ต
- ์ค์๊ฐ ํ๊ฐ ๋ฐ ํผ๋๋ฐฑ
- ๋ค์ํ LLM ์ง์ (OpenAI, Gemini, Claude, Ollama, Perplexity)
- RAG ๊ธฐ๋ฐ ์ปจํ ์คํธ ๊ฒ์
- ๋งค๋ด์ผ ๊ธฐ๋ฐ ์๋๋ฆฌ์ค ์๋ ์์ฑ
- JWT ๊ธฐ๋ฐ ์ธ์ฆ (ํ์/๋นํ์ ๋ชจ๋)
- ์ฌ์ฉ์๋ณ ์ค์ ์ ์ฅ (API ํค, ๋ชจ๋ธ ์ ํ)
- ํ๋ก์ ํธ/๋ํ ์ฌ์ฉ์ ๊ฒฉ๋ฆฌ
| ๊ตฌ์ฑ์์ | ๋ฒ์ | ๋น๊ณ |
|---|---|---|
| Node.js | 18.x ์ด์ | LTS ๊ถ์ฅ |
| Python | 3.10 ์ด์ | 3.11 ๊ถ์ฅ |
| npm | 9.x ์ด์ | Node.js์ ํจ๊ป ์ค์น๋จ |
| ๊ตฌ์ฑ์์ | ์ฉ๋ |
|---|---|
| Ollama | ๋ก์ปฌ LLM ์ฌ์ฉ ์ ํ์ |
| CUDA | GPU ๊ฐ์ ์๋ฒ ๋ฉ ์ ํ์ |
git clone <repository-url>
cd PWS_V3cd ai
# ๊ฐ์ํ๊ฒฝ ์์ฑ ๋ฐ ํ์ฑํ
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# ์์กด์ฑ ์ค์น
pip install -r requirements.txt
# ์๋ฒ ์คํ
uvicorn main:app --host 0.0.0.0 --port 8000cd backend
# ํ๊ฒฝ ๋ณ์ ์ค์
cp .env.example .env
# .env ํ์ผ์ ์ด์ด JWT_SECRET ๋ฑ ์์
# ์์กด์ฑ ์ค์น
npm install
# ๊ฐ๋ฐ ๋ชจ๋ ์คํ
npm run start:dev
# ๋๋ ํ๋ก๋์
๋น๋
npm run build
npm run start:prodcd frontend
# ํ๊ฒฝ ๋ณ์ ์ค์
cp .env.example .env
# .env ํ์ผ์ ์ด์ด VITE_BACKEND_URL ์์ (ํ์์)
# ์์กด์ฑ ์ค์น
npm install
# ๊ฐ๋ฐ ๋ชจ๋ ์คํ
npm run dev
# ๋๋ ํ๋ก๋์
๋น๋
npm run build๋ธ๋ผ์ฐ์ ์์ http://localhost:5173 ์ ์
AI ์๋น์ค (/etc/systemd/system/cs-ai.service):
[Unit]
Description=CS Simulator AI Service
After=network.target
[Service]
Type=simple
User=www-data
WorkingDirectory=/path/to/PWS_V3/ai
Environment="PATH=/path/to/PWS_V3/ai/venv/bin"
ExecStart=/path/to/PWS_V3/ai/venv/bin/uvicorn main:app --host 0.0.0.0 --port 8000
Restart=always
[Install]
WantedBy=multi-user.target๋ฐฑ์๋ (/etc/systemd/system/cs-backend.service):
[Unit]
Description=CS Simulator Backend
After=network.target
[Service]
Type=simple
User=www-data
WorkingDirectory=/path/to/PWS_V3/backend
ExecStart=/usr/bin/node /path/to/PWS_V3/backend/dist/main.js
Restart=always
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.targetserver {
listen 80;
server_name your-domain.com;
# Frontend (์ ์ ํ์ผ)
location / {
root /path/to/PWS_V3/frontend/build;
try_files $uri $uri/ /index.html;
}
# Backend API
location /api/ {
proxy_pass http://localhost:3001/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_cache_bypass $http_upgrade;
}
# AI Service (๋ด๋ถ์ฉ, ํ์์)
location /ai/ {
proxy_pass http://localhost:8000/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}docker-compose.yml ์์๋ ๋ณ๋ ๋ฌธ์ ์ฐธ์กฐ
| ๋ณ์๋ช | ์ค๋ช | ๊ธฐ๋ณธ๊ฐ |
|---|---|---|
AI_SERVICE_URL |
AI ์๋น์ค URL | http://localhost:8000 |
JWT_SECRET |
JWT ์๋ช ํค (ํ์ ๋ณ๊ฒฝ) | - |
JWT_REFRESH_SECRET |
๋ฆฌํ๋ ์ ํ ํฐ ํค (ํ์ ๋ณ๊ฒฝ) | - |
| ๋ณ์๋ช | ์ค๋ช | ๊ธฐ๋ณธ๊ฐ |
|---|---|---|
VITE_BACKEND_URL |
Backend API URL | http://localhost:3001 |
- ๊ธฐ๋ณธ URL:
http://localhost:3001 - Swagger:
http://localhost:3001/api(๊ฐ๋ฐ ๋ชจ๋)
- ๊ธฐ๋ณธ URL:
http://localhost:8000 - Swagger:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
- Python ๋ฒ์ ํ์ธ (3.10 ์ด์)
- CUDA ๊ด๋ จ ์ค๋ฅ ์ CPU ๋ชจ๋๋ก ์คํ
- ๋ฉ๋ชจ๋ฆฌ ๋ถ์กฑ ์ ์๋ฒ ๋ฉ ๋ชจ๋ธ ๋ณ๊ฒฝ ๊ณ ๋ ค
- AI_SERVICE_URL ํ๊ฒฝ ๋ณ์ ํ์ธ
- AI ์๋น์ค๊ฐ ์คํ ์ค์ธ์ง ํ์ธ
- ๋ฐฉํ๋ฒฝ ํฌํธ ์ค์ ํ์ธ
- VITE_BACKEND_URL ์ค์ ํ์ธ
- CORS ์ค์ ํ์ธ (๋ฐฑ์๋)
- ๋คํธ์ํฌ ํญ์์ ์์ฒญ/์๋ต ํ์ธ
์ด ํ๋ก์ ํธ๋ ์ฌ๋ด ๊ต์ก์ฉ์ผ๋ก ์ ์๋์์ต๋๋ค.