astrbot_plugin_imagestudio/DEVELOPMENT.md

98 行
2.7 KiB
Markdown

# Development Environment
## Scope
The repository is currently prepared for v3 `S0-1`.
Prepared:
- AstrBot plugin root files and v3 configuration placeholders.
- v3 top-level module layout: `adapters`, `core`, `engines`, `backend`, `database`, `assets_builtin`, `frontend`, `pages`, `web`, and `data`.
- Database helper foundation with SQLite default and optional PostgreSQL selection from `config.yaml`.
- `character_profiles` persistence and service layer with audit logging.
- Frontend source skeleton for Plugin Page UI and Standalone Web UI.
- Runtime data directories with `.gitkeep` files only.
- Generated data, local virtual environments, node modules, and build artifacts are ignored.
Not implemented yet:
- AstrBot adapter registration.
- Repositories and business services.
- P0 API routes.
- Real UI screens beyond scaffold placeholders.
## Local Tools
On this machine, PowerShell blocks `npm.ps1`; use `npm.cmd` when needed.
Codex bundled tools are also available:
```text
C:\Users\Administrator\.cache\codex-runtimes\codex-primary-runtime\dependencies\python\python.exe
C:\Users\Administrator\.cache\codex-runtimes\codex-primary-runtime\dependencies\bin\pnpm.cmd
```
## First Tasks
Follow `imagestudio_codex_hermes_dev_flow_v3.md` and continue with:
```text
S1-2 实现 profile_workflows 和 workflow_nodes
S1-3 实现 generation_images
S2-1 实现 ui/bootstrap
S2-2 实现 dashboard/summary
```
## P0 Frozen API Checklist
P0 must implement these before expanding into advanced flows:
```text
ui/bootstrap
dashboard/summary
profiles GET/POST/GET_ONE/PUT
profiles/quick-draft
profiles/{profile_id}/workflows GET/POST
workflows/{workflow_id}
workflows/{workflow_id}/nodes
nodes/{node_id}/generate
nodes/{node_id}/images
images/{image_id}
images/{image_id}/select
jobs
jobs/{task_id}
settings/schema
settings/current
storage/status
media/sign
```
Do not start a separate FastAPI, Flask, or Vite production port for the plugin. Dev servers may only be used for local frontend development before build output is copied into AstrBot static paths.
## Database Backend
Default behavior:
```text
database.backend = auto
postgresql.enabled = false
selected backend = sqlite
```
When PostgreSQL is configured:
```yaml
database:
backend: auto
postgresql:
enabled: true
host: 127.0.0.1
port: 5432
database: imagestudio
user: imagestudio
password: ""
```
With `backend: auto`, enabling a complete PostgreSQL config makes PostgreSQL the selected backend. Use `backend: sqlite` to force SQLite even when PostgreSQL fields exist, or `backend: postgresql` to fail fast when PG config/driver is missing.
PostgreSQL support is optional and only imports `psycopg` when the PG backend is selected.