Skip to content

Commit ca6f12a

Browse files
committed
docs fixes
1 parent b68d70a commit ca6f12a

24 files changed

Lines changed: 2902 additions & 806 deletions

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ RUN set -eux; \
441441

442442
# Copy app/UI sources late to improve build caching on frequent code changes
443443
COPY apps /opt/pilot/apps
444+
COPY docs /opt/pilot/docs
444445
COPY README.md /opt/pilot/README.md
445446
COPY CHANGELOG /opt/pilot/CHANGELOG
446447

apps/Portal/app.py

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,23 +602,64 @@ async def add_no_cache_headers(request: Request, call_next):
602602
DOCS_ROOT_PRIMARY = Path("/opt/pilot/docs")
603603
DOCS_ROOT_FALLBACK = Path("/workspace/docs")
604604
DOCS_ROOT_DEV = Path(__file__).resolve().parents[2] / "docs"
605+
DOCS_ROOT_WORKSPACE_REPO = WORKSPACE_ROOT / "lora-pilot" / "docs"
606+
DOCS_ROOT_CWD = Path.cwd() / "docs"
607+
DOCS_ROOT_ENV = os.environ.get("DOCS_ROOT", "").strip()
605608
DOCS_SITEMAP_PRIMARY = DOCS_ROOT_PRIMARY / "README.md"
606609
DOCS_SITEMAP_FALLBACK = DOCS_ROOT_FALLBACK / "README.md"
607610
DOCS_SITEMAP_DEV = DOCS_ROOT_DEV / "README.md"
608611

609612

610613
def _docs_root_candidates() -> list[Path]:
611614
roots: list[Path] = []
612-
for candidate in (DOCS_ROOT_PRIMARY, DOCS_ROOT_FALLBACK, DOCS_ROOT_DEV):
615+
raw_candidates = [
616+
DOCS_ROOT_PRIMARY,
617+
DOCS_ROOT_FALLBACK,
618+
DOCS_ROOT_DEV,
619+
DOCS_ROOT_WORKSPACE_REPO,
620+
DOCS_ROOT_CWD,
621+
]
622+
if DOCS_ROOT_ENV:
623+
raw_candidates.insert(0, Path(DOCS_ROOT_ENV))
624+
625+
for candidate in raw_candidates:
613626
try:
614627
resolved = candidate.resolve()
615628
except Exception:
616629
continue
617630
if resolved.exists() and resolved.is_dir():
618-
roots.append(resolved)
631+
if resolved not in roots:
632+
roots.append(resolved)
619633
return roots
620634

621635

636+
def _build_docs_sitemap_fallback() -> str:
637+
root = next(iter(_docs_root_candidates()), None)
638+
if root is None:
639+
return (
640+
"# Documentation\n\n"
641+
"Docs sitemap was not found in this runtime image.\n\n"
642+
"- `docs/README.md`: Not found in runtime filesystem\n"
643+
"- Set `DOCS_ROOT` to a valid docs directory if you mount docs externally.\n"
644+
"- For bundled docs, use an image build that includes `docs/`.\n"
645+
)
646+
647+
files = sorted(p for p in root.rglob("*.md") if p.is_file())
648+
lines = [
649+
"# Documentation",
650+
"",
651+
f"_Auto-generated sitemap from `{root}` because `docs/README.md` was not found._",
652+
"",
653+
]
654+
for p in files:
655+
rel = p.relative_to(root).as_posix()
656+
title = p.stem.replace("-", " ").replace("_", " ").strip().title() or rel
657+
lines.append(f"- [{title}]({rel})")
658+
if len(lines) == 4:
659+
lines.append("- No markdown files found under resolved docs root.")
660+
return "\n".join(lines) + "\n"
661+
662+
622663
def _validate_docs_relative_path(raw_path: str) -> Optional[PurePosixPath]:
623664
value = (raw_path or "").strip().replace("\\", "/")
624665
if not value:
@@ -2549,10 +2590,11 @@ def get_changelog():
25492590

25502591
@app.get("/api/docs/sitemap")
25512592
def get_docs_sitemap():
2552-
for candidate in (DOCS_SITEMAP_PRIMARY, DOCS_SITEMAP_FALLBACK, DOCS_SITEMAP_DEV):
2593+
for root in _docs_root_candidates():
2594+
candidate = root / "README.md"
25532595
if candidate.exists():
25542596
return {"content": candidate.read_text(encoding="utf-8"), "source": "docs/README.md"}
2555-
raise HTTPException(status_code=404, detail="docs/README.md not found")
2597+
return {"content": _build_docs_sitemap_fallback(), "source": "docs/README.md"}
25562598

25572599

25582600
@app.get("/api/docs/file")

docs/components/README.md

Lines changed: 49 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -1,200 +1,55 @@
1-
# Components Overview
2-
3-
LoRA Pilot integrates multiple AI tools and services into a unified workspace. Each component serves a specific purpose in the AI workflow, from dataset preparation to model training and inference.
4-
5-
## 🧩 Component Architecture
6-
1+
# Components
2+
3+
This section is the map of LoRA Pilot components. Keep this page as an index; use component pages for actual workflows and settings.
4+
5+
## Component Index
6+
7+
| Component | Role | Default Port/Route | Page |
8+
|---|---|---|---|
9+
| Kohya SS | Full training UI | `6666` | [Kohya SS](kohya-ss.md) |
10+
| AI Toolkit | Modern training stack | `8675` | [AI Toolkit](ai-toolkit.md) |
11+
| Diffusion Pipe | Experimental training + TensorBoard | `4444` | [Diffusion Pipe](diffusion-pipe.md) |
12+
| ComfyUI | Node-based inference | `5555` | [ComfyUI](comfyui.md) |
13+
| InvokeAI | UI-first inference | `9090` | [InvokeAI](invokeai.md) |
14+
| TrainPilot | Guided Kohya launcher | ControlPilot tab | [TrainPilot](trainpilot.md) |
15+
| TagPilot | Dataset prep/tagging | `/tagpilot/` on `7878` | [TagPilot](tagpilot.md) |
16+
| MediaPilot | Output curation/gallery | `/mediapilot/` on `7878` | [MediaPilot](mediapilot.md) |
17+
| Copilot Sidecar | Optional coding assistant backend | `7879` (internal/local) | [Copilot Sidecar](copilot-sidecar.md) |
18+
19+
## How They Fit Together
20+
21+
1. Prepare data in TagPilot.
22+
2. Train with TrainPilot/Kohya/AI Toolkit/Diffusion Pipe.
23+
3. Generate in ComfyUI or InvokeAI.
24+
4. Review and curate in MediaPilot.
25+
26+
## Shared Paths
27+
28+
All components are wired to the same workspace:
29+
- `/workspace/models`
30+
- `/workspace/datasets`
31+
- `/workspace/outputs`
32+
- `/workspace/config`
33+
- `/workspace/logs`
34+
35+
## Quick Ops
36+
37+
```bash
38+
# Service state
39+
docker exec lora-pilot supervisorctl status
40+
41+
# Logs
42+
docker exec lora-pilot tail -n 200 /workspace/logs/controlpilot.out.log
43+
docker exec lora-pilot tail -n 200 /workspace/logs/comfy.out.log
44+
docker exec lora-pilot tail -n 200 /workspace/logs/invoke.out.log
745
```
8-
LoRA Pilot
9-
├── Training Components
10-
│ ├── Kohya SS - Traditional LoRA trainer
11-
│ ├── AI Toolkit - Modern training stack
12-
│ └── Diffusion Pipe - Scalable pipeline
13-
├── Inference Components
14-
│ ├── ComfyUI - Node-based inference
15-
│ └── InvokeAI - User-friendly interface
16-
├── Management Components
17-
│ ├── ControlPilot - Central dashboard
18-
│ ├── TrainPilot - Training automation
19-
│ ├── TagPilot - Dataset tagging
20-
│ └── MediaPilot - Media management
21-
└── Development Components
22-
├── JupyterLab - Notebook environment
23-
├── Code Server - VS Code in browser
24-
└── Copilot Sidecar - AI assistant
25-
```
26-
27-
## 🎯 Component Matrix
28-
29-
| Component | Purpose | Port | Technology | Use Case |
30-
|-----------|---------|------|------------|----------|
31-
| **ControlPilot** | Central management | 7878 | FastAPI/React | Service orchestration |
32-
| **Kohya SS** | LoRA training | 6666 | Flask/React | Traditional training |
33-
| **AI Toolkit** | Modern training | 8675 | Next.js/Gradio | FLUX/SDXL training |
34-
| **Diffusion Pipe** | Pipeline training | 4444 | Python/TensorBoard | Large-scale training |
35-
| **ComfyUI** | Node-based inference | 5555 | React/WebGL | Complex workflows |
36-
| **InvokeAI** | User inference | 9090 | React/FastAPI | Easy image generation |
37-
| **TrainPilot** | Training automation | - | Python/CLI | Guided training |
38-
| **TagPilot** | Dataset tagging | - | React/FastAPI | Dataset preparation |
39-
| **MediaPilot** | Media management | - | React/FastAPI | Image organization |
40-
| **JupyterLab** | Notebook environment | 8888 | Python/Jupyter | Development |
41-
| **Code Server** | Browser IDE | 8443 | VS Code | Development |
42-
| **Copilot Sidecar** | AI assistant | 7879 | FastAPI | Code assistance |
43-
44-
## 🔄 Integration Benefits
45-
46-
### Shared Resources
47-
- **Models**: All components access `/workspace/models`
48-
- **Datasets**: Shared dataset storage in `/workspace/datasets`
49-
- **Outputs**: Unified output directory `/workspace/outputs`
50-
- **Configuration**: Centralized config in `/workspace/config`
51-
52-
### Service Orchestration
53-
- **Supervisor**: All services managed by supervisord
54-
- **Health Monitoring**: Automatic restart and health checks
55-
- **Log Aggregation**: Centralized logging system
56-
- **Resource Management**: Shared GPU and memory management
57-
58-
### Workflow Integration
59-
- **Seamless Transitions**: Move between tools without data loss
60-
- **Format Compatibility**: Standardized model and dataset formats
61-
- **API Integration**: Components communicate via APIs
62-
- **Web Interface**: Unified access through ControlPilot
63-
64-
## 🚀 Component Deep Dives
65-
66-
### Training Stack
67-
68-
#### Kohya SS
69-
- **Strengths**: Battle-tested, extensive model support
70-
- **Best For**: Traditional LoRA training, fine-tuning
71-
- **Models**: SD1.5, SDXL, SD3, custom architectures
72-
- **Features**: Advanced config, extensive documentation
73-
74-
#### AI Toolkit
75-
- **Strengths**: Modern stack, FLUX.1 support, Next.js UI
76-
- **Best For**: Latest model training, FLUX/SDXL
77-
- **Models**: FLUX.1, SDXL, SD3, experimental models
78-
- **Features**: Gradio interface, modern workflows
79-
80-
#### Diffusion Pipe
81-
- **Strengths**: Scalable, TensorBoard integration
82-
- **Best For**: Large-scale training, experiment tracking
83-
- **Models**: All supported models
84-
- **Features**: Pipeline architecture, experiment management
85-
86-
### Inference Stack
87-
88-
#### ComfyUI
89-
- **Strengths**: Node-based, extensible, custom workflows
90-
- **Best For**: Complex generation workflows, automation
91-
- **Features**: Custom nodes, workflow sharing, batch processing
92-
93-
#### InvokeAI
94-
- **Strengths**: User-friendly, stable, good for beginners
95-
- **Best For**: Simple generation, image editing
96-
- **Features**: Canvas mode, inpainting, upscaling
97-
98-
### Management Tools
99-
100-
#### ControlPilot
101-
- **Role**: Central command center
102-
- **Features**: Service control, model management, file browser
103-
- **Integration**: Manages all other components
104-
105-
#### TrainPilot
106-
- **Role**: Training automation
107-
- **Features**: Guided setup, profile management, progress tracking
108-
- **Integration**: Works with Kohya and AI Toolkit
109-
110-
#### TagPilot
111-
- **Role**: Dataset preparation
112-
- **Features**: Image tagging, captioning, dataset export
113-
- **Integration**: Feeds datasets to all trainers
114-
115-
#### MediaPilot
116-
- **Role**: Media organization
117-
- **Features**: Image browsing, metadata, batch operations
118-
- **Integration**: Works with all generated content
119-
120-
## 🛠️ Technology Stack
121-
122-
### Backend Technologies
123-
- **Python 3.11**: Primary language for most components
124-
- **FastAPI**: API framework for web services
125-
- **Flask**: Legacy support (Kohya SS)
126-
- **Node.js**: AI Toolkit UI and Next.js
127-
128-
### Frontend Technologies
129-
- **React**: Modern UI framework
130-
- **Vue.js**: Legacy support (some components)
131-
- **Gradio**: AI Toolkit interface
132-
- **WebGL**: ComfyUI rendering
133-
134-
### Infrastructure
135-
- **Docker**: Containerization
136-
- **Supervisor**: Process management
137-
- **Nginx**: Reverse proxy (some components)
138-
- **SQLite**: Local databases
139-
140-
## 🔧 Configuration
141-
142-
### Service Configuration
143-
Each component has its own configuration:
144-
- **Environment Variables**: Service-specific settings
145-
- **Config Files**: YAML/TOML configuration
146-
- **Database**: SQLite for state management
147-
- **Logging**: Structured logging to files
148-
149-
### Resource Allocation
150-
- **GPU Sharing**: Components share GPU resources
151-
- **Memory Management**: Automatic memory optimization
152-
- **Storage**: Shared workspace with quotas
153-
- **Network**: Port-based service isolation
154-
155-
## 📊 Performance Characteristics
156-
157-
### Training Performance
158-
| Component | Speed | Memory Usage | Model Support |
159-
|-----------|-------|--------------|---------------|
160-
| Kohya SS | Medium | Medium | Excellent |
161-
| AI Toolkit | Fast | High | Good |
162-
| Diffusion Pipe | Fast | Medium | Excellent |
163-
164-
### Inference Performance
165-
| Component | Speed | Memory Usage | Features |
166-
|-----------|-------|--------------|----------|
167-
| ComfyUI | Fast | Medium | Extensive |
168-
| InvokeAI | Medium | Low | User-friendly |
169-
170-
## 🔄 Version Compatibility
171-
172-
### Component Versions
173-
- **Kohya SS**: Latest stable from upstream
174-
- **AI Toolkit**: Tracked to specific commits
175-
- **ComfyUI**: Latest with custom nodes
176-
- **InvokeAI**: Pinned stable version
177-
178-
### Dependency Management
179-
- **Shared Venvs**: Components share Python environments
180-
- **Version Pinning**: Critical dependencies are pinned
181-
- **Conflict Resolution**: Separate venvs for conflicting packages
182-
- **Update Strategy**: Controlled updates with testing
183-
184-
## 🚀 Future Components
18546

186-
### Planned Additions
187-
- **Training Scheduler**: Advanced training scheduling
188-
- **Model Registry**: Centralized model versioning
189-
- **Experiment Tracker**: ML experiment management
190-
- **API Gateway**: Unified API for all services
47+
## Related
19148

192-
### Integration Opportunities
193-
- **Cloud Storage**: S3/Google Drive integration
194-
- **Model Sharing**: Community model sharing
195-
- **Collaboration**: Multi-user workspaces
196-
- **Automation**: Workflow automation tools
49+
- [User Guide](../user-guide/README.md)
50+
- [Configuration](../configuration/README.md)
51+
- [Documentation Home](../README.md)
19752

19853
---
19954

200-
*Last updated: 2025-02-11*
55+
_Last updated: 2026-02-11_

0 commit comments

Comments
 (0)