AI chat powered by Groq (Llama). Requires login (JWT from auth-service). Fetches units from auth-service for "find units near my location" queries.
-
Copy
.env.exampleto.envand set:GROQ_API_KEY- Get from Groq ConsoleAUTH_SERVICE_URL- Auth service URL (default: http://localhost:3001)
-
Install and run:
npm install npm run dev
docker compose up --buildRuns on port 3003. Set AUTH_SERVICE_URL=http://host.docker.internal:3001 when auth-service runs on host.
GET /health- Health checkPOST /api/chat- Send message (Bearer token required)
Request body:
{
"message": "Find units near my location",
"history": [{"role": "user", "content": "..."}, {"role": "model", "content": "..."}],
"latitude": 14.5995,
"longitude": 120.9842
}Pass latitude and longitude for "near me" queries - units are sorted by distance.
Add to .env.local:
AI_CHATBOT_URL=http://localhost:3003
Chat is available via the floating widget (when logged in) or /chat page.