astrbot_plugin_imagestudio/INSTALL.md

2.5 KiB

Installation and Packaging

ImageStudio is an AstrBot plugin. Do not run it as a standalone FastAPI, Flask, or Vite production service.

Install Into AstrBot

  1. Clone or copy this repository into AstrBot's plugin directory as astrbot_plugin_imagestudio.
  2. Keep the repository root files in place: metadata.yaml, main.py, config.yaml, _conf_schema.json.
  3. Restart or reload AstrBot so it can discover the plugin metadata.
  4. AstrBot should call main.get_plugin_manifest() or main.register_plugin(runtime) to discover extension routes and the web mount.

The backend API is mounted under:

/api/v1/plugins/extensions/astrbot_plugin_imagestudio

The standalone web entry is mounted under:

/api/v1/plugins/extensions/astrbot_plugin_imagestudio/web

Database

SQLite is the default and requires no extra service:

database:
  backend: auto
  sqlite:
    path: data/db/imagestudio.db
  postgresql:
    enabled: false

PostgreSQL is selected when backend: postgresql, or when backend: auto and postgresql.enabled plus connection fields are configured.

database:
  backend: auto
  postgresql:
    enabled: true
    host: 127.0.0.1
    port: 5432
    database: imagestudio
    user: imagestudio
    password: ""

The plugin supports either psycopg or psycopg2 when PostgreSQL is selected.

Secrets

Do not commit .env*, API keys, DSNs, or integration tokens. Runtime tokens are rotated through:

POST integrations/private-companion/token/rotate

The rotate response returns the new token once. Config stores only salt and hash.

Smoke Checks

Run the non-UI backend smoke:

python scripts/imagestudio_non_ui_smoke.py

Run the PostgreSQL plan without connecting:

python scripts/imagestudio_pg_smoke.py --dry-run

Run full tests:

python -m unittest discover -s tests
python -m compileall adapters backend core database engines scripts tests main.py

Optional live PostgreSQL smoke:

$env:IMAGESTUDIO_TEST_PG_DSN = "postgresql://user:password@127.0.0.1:5432/imagestudio_test"
python -m unittest tests.test_pg_smoke

Package

Use Git so ignored local data and secrets are excluded:

git archive --format=zip --output astrbot_plugin_imagestudio.zip HEAD

The package should include source modules, migrations, built/static assets, config templates, and docs. It should not include:

  • .git/
  • .env*
  • data/* runtime contents
  • node_modules/
  • __pycache__/
  • local test databases or generated media