feat: web login system, auto-load history, config extraction

- Add Flask session-based authentication (username/password login)
- Auto-load chat history from backend on page load
- Extract SECRET_KEY and user credentials to web_config.json
- Create web_config.example.json as template
- Add web_config.json to .gitignore (sensitive info)
- Update docs: architecture, API reference, quick start guides
This commit is contained in:
root
2026-04-28 09:25:47 +08:00
parent 0ebd1d7ac6
commit 46008c14c5
10 changed files with 143 additions and 4 deletions

View File

@ -505,4 +505,25 @@ Common errors:
|--------------|-------------|
| `API Key not configured` | API Key not set |
| `timeout` | Request timeout |
| `Tool call rejected: ...` | Tool call rate exceeded limit |
| `Tool call rejected: ...` | Tool call rate exceeded limit |
## Web API Endpoints
| Method | Path | Description |
|--------|------|-------------|
| GET | /api/check-auth | Check if current session is authenticated |
| POST | /api/login | Login (JSON body: username, password) |
| POST | /api/logout | Logout |
| GET | /api/history | Get chat history |
| POST | /api/message | Send message to AI |
| POST | /api/tools/execute | Execute tool call |
| GET | /api/status | Get system status |
| GET | /api/settings | Get settings |
| PUT | /api/settings | Update settings |
| DELETE | /api/history | Clear history |
| POST | /api/shutdown | Shutdown server |
| GET | /api/activity | Get database operation records |
| GET | /api/graph | Get knowledge graph data |
| GET | /api/graph/highlight | Get highlighted nodes |
All API endpoints (except /api/login and /api/check-auth) require authentication. Login uses Flask sessions with 7-day validity.