Initial commit: 5 Why Root Cause Analyzer v1.0.0
Phase 0 & Phase 2 completed: - Project structure setup - Environment configuration (.env, .gitignore) - Enterprise-grade dependencies (bcrypt, helmet, mysql2, etc.) - Complete database schema with 8 tables + 2 views - Database initialization scripts - Comprehensive documentation Database Tables: - users (user management with 3-tier permissions) - analyses (analysis records) - analysis_perspectives (multi-angle analysis) - analysis_whys (detailed 5 Why records) - llm_configs (LLM API configurations) - system_settings (system parameters) - audit_logs (security audit trail) - sessions (session management) Tech Stack: - Backend: Node.js + Express - Frontend: React 18 + Vite + Tailwind CSS - Database: MySQL 9.4.0 - AI: Ollama API (qwen2.5:3b) Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
122
README.md
Normal file
122
README.md
Normal file
@@ -0,0 +1,122 @@
|
||||
# 5 Why 根因分析器
|
||||
|
||||
這是一個基於 5 Why 方法論的根因分析工具,使用 Ollama API (qwen2.5:3b 模型) 進行智能分析。
|
||||
|
||||
## 功能特點
|
||||
|
||||
- ✅ 使用 5 Why 方法進行深度根因分析
|
||||
- ✅ 從三個不同角度進行分析(流程面、系統面、管理面等)
|
||||
- ✅ 支援多語言輸出(繁中、簡中、英文、日文、韓文、越南文、泰文)
|
||||
- ✅ 提供執行要項指南
|
||||
- ✅ 邏輯雙向檢核
|
||||
- ✅ 產出永久性對策建議
|
||||
|
||||
## 技術架構
|
||||
|
||||
### 後端
|
||||
- Node.js + Express
|
||||
- Ollama API 整合
|
||||
- API URL: `https://ollama_pjapi.theaken.com`
|
||||
- 模型: `qwen2.5:3b`
|
||||
|
||||
### 前端
|
||||
- React 18
|
||||
- Vite
|
||||
- Tailwind CSS
|
||||
- 響應式設計
|
||||
|
||||
## 安裝與執行
|
||||
|
||||
### 1. 安裝依賴
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
### 2. 啟動應用(同時啟動前端和後端)
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
這會同時啟動:
|
||||
- 後端服務器: http://localhost:3001
|
||||
- 前端開發服務器: http://localhost:5173
|
||||
|
||||
### 3. 單獨啟動
|
||||
|
||||
如果需要單獨啟動:
|
||||
|
||||
```bash
|
||||
# 只啟動後端
|
||||
npm run server
|
||||
|
||||
# 只啟動前端
|
||||
npm run client
|
||||
```
|
||||
|
||||
### 4. 生產環境建置
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
## 使用說明
|
||||
|
||||
1. 填寫「Finding」:具體描述問題現象(使用 5W1H)
|
||||
2. 填寫「工作內容」:說明您的職責範圍
|
||||
3. 選擇輸出語言
|
||||
4. 點擊「Find My 5 Why」進行分析
|
||||
5. 查看三個不同角度的分析結果
|
||||
6. 可以使用翻譯功能切換不同語言
|
||||
|
||||
## API 端點
|
||||
|
||||
### 後端 API
|
||||
|
||||
- `GET /health` - 健康檢查
|
||||
- `GET /api/models` - 列出可用的 Ollama 模型
|
||||
- `POST /api/analyze` - 執行 5 Why 分析
|
||||
- `POST /api/translate` - 翻譯分析結果
|
||||
|
||||
### 請求範例
|
||||
|
||||
```javascript
|
||||
// 分析請求
|
||||
fetch('http://localhost:3001/api/analyze', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ prompt: '您的分析提示...' })
|
||||
})
|
||||
```
|
||||
|
||||
## 專案結構
|
||||
|
||||
```
|
||||
5why/
|
||||
├── server.js # Express 後端服務器
|
||||
├── package.json # 專案配置
|
||||
├── vite.config.js # Vite 配置
|
||||
├── tailwind.config.js # Tailwind CSS 配置
|
||||
├── postcss.config.js # PostCSS 配置
|
||||
├── index.html # HTML 入口
|
||||
└── src/
|
||||
├── main.jsx # React 入口
|
||||
├── App.jsx # 主應用組件
|
||||
├── FiveWhyAnalyzer.jsx # 5 Why 分析器組件
|
||||
└── index.css # 全局樣式
|
||||
```
|
||||
|
||||
## 注意事項
|
||||
|
||||
1. 確保 Ollama API 服務可用
|
||||
2. 後端服務必須先啟動才能進行分析
|
||||
3. 建議使用 Chrome 或 Firefox 瀏覽器以獲得最佳體驗
|
||||
4. 分析時間可能需要 30-60 秒,請耐心等待
|
||||
|
||||
## 環境要求
|
||||
|
||||
- Node.js 16+
|
||||
- npm 或 yarn
|
||||
- 現代瀏覽器(支援 ES6+)
|
||||
|
||||
## 授權
|
||||
|
||||
MIT License
|
||||
Reference in New Issue
Block a user