AgentSkillsCN

Dev Server

启动并管理 CARF 开发服务器(API、Streamlit、React 控制台)

SKILL.md
--- frontmatter
description: Start and manage CARF development servers (API, Streamlit, React cockpit)

CARF Dev Server Skill

Purpose

Start/stop development servers for local development, demos, and verification.

When to Use

  • Starting local development session
  • Running demos for stakeholders
  • Verifying UI/API changes
  • Integration testing

Components

ComponentPortPurpose
FastAPI8000Backend API (/query, /scenarios, /datasets)
Streamlit8501Legacy Epistemic Cockpit (3 view modes)
React5173Platform Cockpit (Vite dev server)

Execution Steps

Start All Servers

1. Start Backend API

powershell
cd c:\Users\35845\Desktop\DIGICISU\projectcarf
.venv\Scripts\python -m uvicorn src.main:app --host 0.0.0.0 --port 8000 --reload

Verification:

bash
curl http://localhost:8000/health
# Expected: {"status": "healthy", ...}

2. Start Streamlit Dashboard (Optional)

Open a new terminal:

powershell
cd c:\Users\35845\Desktop\DIGICISU\projectcarf
.venv\Scripts\python -m streamlit run src/dashboard/app.py --server.port 8501

URL: http://localhost:8501

3. Start React Cockpit

Open a new terminal:

powershell
cd c:\Users\35845\Desktop\DIGICISU\projectcarf\carf-cockpit
npm run dev

URL: http://localhost:5173

Environment Variables

Ensure .env file exists with required variables:

bash
# Required
LLM_PROVIDER=deepseek
DEEPSEEK_API_KEY=sk-...

# Optional for full stack
NEO4J_URI=bolt://localhost:7687
CARF_API_URL=http://localhost:8000

Docker Compose (Alternative)

For full stack with Neo4j, Kafka, and OPA:

bash
cd c:\Users\35845\Desktop\DIGICISU\projectcarf
docker-compose up -d

Services Started:

Troubleshooting

Port Already in Use

powershell
# Find process using port
netstat -ano | findstr :8000

# Kill process by PID
taskkill /PID <pid> /F

API Not Responding

  1. Check if uvicorn started without errors
  2. Verify .env file exists
  3. Check DEEPSEEK_API_KEY is set

React Dev Server Issues

powershell
cd carf-cockpit
rm -rf node_modules
npm install
npm run dev

Verification Checklist

ServerCheckExpected
APIGET /health{"status": "healthy"}
APIGET /scenariosList of 5 demo scenarios
StreamlitDashboard loads3 view mode tabs visible
ReactCockpit loadsDashboardLayout renders