mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-09-20 08:58:15 +00:00
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:
@ -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.
|
||||
@ -32,7 +32,11 @@ TrulyMEM-TrueHumanMEM/
|
||||
│ ├── services/ # Service layer (config only)
|
||||
│ ├── handlers/ # Event handlers
|
||||
│ └── styles/ # Style files
|
||||
└── tests/ # Tests (54 tests)
|
||||
├── web_api.py # Web API service (login + RESTful API)
|
||||
├── templates/login.html # Login page template
|
||||
├── static/ # Web frontend static files (star map visualization)
|
||||
├── web_config.json # Web service config file (sensitive, not committed)
|
||||
└── web_config.example.json # Web config template
|
||||
```
|
||||
|
||||
## Architecture Diagram
|
||||
|
||||
@ -40,6 +40,26 @@ TrulyMEM.exe
|
||||
|
||||
Config will be automatically saved to `~/.trulymem/config.json` and loaded on next startup.
|
||||
|
||||
### Web Visualization (Optional)
|
||||
|
||||
TrulyMEM provides a Web star-map visualization interface for browsing the knowledge graph in real-time:
|
||||
|
||||
```bash
|
||||
# Start Web service
|
||||
python web_api.py --port 4096
|
||||
```
|
||||
|
||||
Then open `http://localhost:4096` in your browser.
|
||||
|
||||
**Login Setup:**
|
||||
1. Copy `web_config.example.json` to `web_config.json`
|
||||
2. Set login password (using SHA256) and secret key
|
||||
3. Web service will automatically read the config
|
||||
|
||||
Default port is 4096, change with `--port` flag.
|
||||
|
||||
---
|
||||
|
||||
## Keyboard Shortcuts
|
||||
|
||||
| Key | Function |
|
||||
|
||||
Reference in New Issue
Block a user