27 行
1.8 KiB
Markdown
27 行
1.8 KiB
Markdown
# Frontend
|
|
|
|
The frontend contains two Vite applications:
|
|
|
|
- `plugin-page/`: builds into `../pages/imagestudio`.
|
|
- `standalone-web/`: builds into `../web`.
|
|
|
|
Shared API clients, types, stores, components, constants, schemas, and utilities live in `shared/`.
|
|
|
|
The Workbench is split by responsibility:
|
|
|
|
- `standalone-web/src/App.vue` owns page orchestration, backend state, and cross-feature coordination.
|
|
- `standalone-web/src/components/` contains reusable navigation, metric, state, empty-state, image-preview, and material-dialog components.
|
|
- `standalone-web/src/features/` contains feature-level pure logic such as external character-profile parsing.
|
|
- `standalone-web/src/types/` contains shell/navigation contracts shared by the Workbench components.
|
|
- `shared/utils/` contains presentation and `storage://` helpers reused by both the Workbench and dialogs.
|
|
|
|
Keep new modal, status-card, metric-card, parsing, and formatting logic out of `App.vue` when an existing component or utility can own it. The Workbench stylesheet is intentionally app-global inside the standalone page/plugin iframe so extracted components can reuse the same design tokens and class primitives.
|
|
|
|
Install dependencies with `npm.cmd install` on Windows or `npm install` on other platforms. Validate with `npm.cmd run typecheck`, then build both targets with `npm.cmd run build`.
|
|
|
|
Both targets render the same Workbench implementation and consume the same v3 API contract:
|
|
|
|
- Plugin Page UI prefers `window.AstrBotPluginPage`; the shared client unwraps AstrBot and ImageStudio response envelopes and provides a POST method-override envelope for legacy bridges that only expose GET/POST.
|
|
- Standalone Web UI uses `/api/v1/plugins/extensions/astrbot_plugin_imagestudio`.
|
|
|
|
Do not store API keys, media paths, or selected image state in frontend-only storage.
|