A knowledge base application for EMQX that allows users to ask questions and get answers based on the knowledge base. It also includes a log analysis feature for EMQX logs.
- Ask questions and get answers based on the knowledge base
- Upload files to provide additional context for questions
- Analyze EMQX logs to identify issues and get troubleshooting recommendations
- Slack integration for asking questions and getting answers
- Backend: FastAPI, SQLAlchemy, LlamaIndex
- Frontend: Vue.js, Tailwind CSS
- Database: PostgreSQL
- LLM Support: OpenAI, Anthropic, Cohere, Gemini, HuggingFace (via LlamaIndex)
- Clone the repository
- Install uv (if not already installed):
curl -LsSf https://astral.sh/uv/install.sh | sh
- Set up environment variables:
cp .env.example .env
- Edit the
.env
file to set your LLM API key and other configuration options - Run the application:
uv run main.py
LLM_PROVIDER
: The LLM provider to use (default: openai, options: openai, anthropic, cohere, gemini, huggingface)LLM_API_KEY
: Your LLM API keyLLM_MODEL
: The model to use (depends on the provider, default: gpt-4o)LLM_TEMPERATURE
: The temperature to use for generation (default: 0.7)EMBEDDING_MODEL
: The embedding model to use (default: text-embedding-3-small)EMBEDDING_DIMENSION
: The dimension of the embeddings (default: 1536)
DATABASE_URL
: The database URL (default: postgresql://postgres:postgres@localhost:5432/knowledge_base)
SLACK_BOT_TOKEN
: Your Slack bot token (optional)SLACK_APP_TOKEN
: Your Slack app token (optional)SLACK_SIGNING_SECRET
: Your Slack signing secret (optional)SLACK_TEAM_ID
: Your Slack team ID (optional)
ENABLE_SLACK
: Whether to enable Slack integration (default: false)
LOG_LEVEL
: The logging level to use (default: INFO, options: DEBUG, INFO, WARNING, ERROR, CRITICAL)LLAMA_INDEX_VERBOSE
: Whether to show verbose LlamaIndex logs, including workflow step execution (default: false)
GET /api/health
: Health check endpoint
The web UI is available at http://localhost:8000 and includes a unified chat interface that can:
- Answer questions about EMQX Knowledge Base
- Analyze EMQX logs for troubleshooting
- Process file uploads for log analysis
- Handle EMQX API credentials to query broker information
To set up the development environment:
- Install frontend dependencies:
cd web npm install
- Run the backend:
uv run main.py
- Run the frontend:
cd web npm run dev
This project is licensed under the MIT License - see the LICENSE file for details.