2026-08-06 10:22:10 +00:00
|
|
|
|
# 平台管理与系统管理员
|
|
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
系统管理员负责整个 WeKnora 部署的全局设置、任务队列、平台 API Key 和跨空间审计。空间 Owner 负责单个工作空间,两类身份分别授予。空间角色说明见[租户、用户与认证授权](01-tenant-auth.md)。
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
两类身份的管理范围如下:
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
|
|
|
|
|
| | 空间 Owner | 系统管理员 |
|
|
|
|
|
|
| --- | --- | --- |
|
|
|
|
|
|
| 作用范围 | 单个工作空间 | 整个部署 |
|
2026-09-08 02:54:41 +00:00
|
|
|
|
| 授予方式 | 创建空间时获得,或由原 Owner 转让 | 由现有系统管理员授予,首个管理员通过环境变量引导 |
|
|
|
|
|
|
| 管理内容 | 空间成员、模型、知识库、集成、空间审计 | 全局系统设置、任务队列、平台 API Key、跨空间审计、重置用户密码 |
|
2026-08-06 10:22:10 +00:00
|
|
|
|
| 是否自动叠加 | — | **不会**:在某空间是 Owner 不代表是系统管理员,反之亦然 |
|
|
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
跨空间数据访问由 `CanAccessAllTenants` 单独控制。系统管理员身份不会自动授予其他空间的知识库内容访问权。
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
|
|
|
|
|
<Screenshot
|
|
|
|
|
|
src="/screenshots/settings-system-admin.png"
|
|
|
|
|
|
caption="平台控制台:系统设置、任务队列、平台 API Key 与系统审计日志"
|
|
|
|
|
|
hint="以系统管理员身份打开「设置」,展示侧栏底部四个仅系统管理员可见的分区,正文可用系统设置页。" />
|
|
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
## 设置首个系统管理员 {#_1-第一个系统管理员怎么来}
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
新部署需要先设置首个系统管理员:
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
|
|
|
|
|
1. 先用正常流程注册一个账号;
|
2026-09-08 02:54:41 +00:00
|
|
|
|
2. 为 app 服务配置 `WEKNORA_BOOTSTRAP_SYSTEM_ADMIN_EMAIL=<该账号邮箱>`,重启;
|
|
|
|
|
|
3. 启动时仅在部署尚无系统管理员的情况下,将该邮箱对应的用户设为系统管理员。
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
引导流程只提升已存在的账号。邮箱尚未注册时会记录告警,后续重启再次检查;配置错误不阻断服务启动。部署已有系统管理员后,该变量不再授予权限。
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
后续可在界面中添加或撤销系统管理员。不能撤销自己,也不能撤销最后一位系统管理员。对应接口为 `POST /system/admin/promote` 和 `/revoke`;重复撤销非管理员返回 200,审计记录以 `changed=false` 标明未发生权限变更。
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
## 使用平台控制台 {#_2-控制台能做什么}
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
feat(models): add system admin model catalog console (#3662)
* feat(models): add system admin model catalog console
System administrators can now maintain the model catalog from
Settings → System administration → Model catalog instead of editing
models.json on every replica. Administrator changes are stored as a
versioned overlay in the database (new model_catalog_config table),
layered between the deployment file and explicit per-model settings,
and synchronised to other instances within about 5 seconds.
Backend
- GET/POST preview/PUT /system/admin/model-catalog with optimistic
version + deployment baseline checks (409 on conflict), 20-version
history and audit logging.
- Console overlays reject credentials, headers, env interpolation and
non-inline icons; those stay deployment-owned.
- Catalog views include each chat model's resolved thinking levels and
the vendor defaults, so the console never re-implements level
inheritance.
Frontend
- Model list in the shared data-table style with provider/type filters,
"modified only" filter and source tags (built-in / deployment / admin).
- Edit drawer saves and applies immediately: display name, context
window, max output, input modalities, reasoning, thinking levels,
embedding dimension and picker visibility, each with its inherited
default and a layer comparison table.
- Add-model drawer, JSON editor with server-side change check before
publishing, and version history with one-step restore.
- Model settings gets a system-admin shortcut to the catalog; model
editor reloads providers when opened so published catalogs apply.
* fix(models): harden the admin model catalog console
- Reject console base_url, base_urls, url_patterns and auth: moving a
vendor's default URL would send its deployment api_key (and keys of rows
without their own base URL) to another host. With every interpolated
field now deployment-owned, '$' in names and descriptions is plain text.
- Drop deployment base URLs from catalog views; they may carry
interpolated tokens.
- Remember a stored version this replica cannot compile and skip it until
the version changes, instead of re-reading and recompiling every poll.
- Resolve vendor default thinking levels with reasoning forced on, like
per-model levels.
- Compute builtin/deployment views once; preview returns only the
candidate catalog and normalized overlay.
- Share deployment file lookup via runtime.ReadDeploymentOverlay.
- The model editor force-refreshes its own type instead of resetting the
provider store for every type; the refreshed list wins in the id index.
2026-09-24 08:31:45 +00:00
|
|
|
|
系统管理员可在「设置」侧栏查看以下管理分区:
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
|
|
|
|
|
| 分区 | 作用 | 接口 |
|
|
|
|
|
|
| --- | --- | --- |
|
2026-09-08 02:54:41 +00:00
|
|
|
|
| 系统设置 | 全局运行时开关(注册模式、空间策略、并发、SSRF 白名单等),按设置项的生效规则应用,见下方设置表 | `GET/PUT/DELETE /system/admin/settings[/:key]` |
|
feat(models): add system admin model catalog console (#3662)
* feat(models): add system admin model catalog console
System administrators can now maintain the model catalog from
Settings → System administration → Model catalog instead of editing
models.json on every replica. Administrator changes are stored as a
versioned overlay in the database (new model_catalog_config table),
layered between the deployment file and explicit per-model settings,
and synchronised to other instances within about 5 seconds.
Backend
- GET/POST preview/PUT /system/admin/model-catalog with optimistic
version + deployment baseline checks (409 on conflict), 20-version
history and audit logging.
- Console overlays reject credentials, headers, env interpolation and
non-inline icons; those stay deployment-owned.
- Catalog views include each chat model's resolved thinking levels and
the vendor defaults, so the console never re-implements level
inheritance.
Frontend
- Model list in the shared data-table style with provider/type filters,
"modified only" filter and source tags (built-in / deployment / admin).
- Edit drawer saves and applies immediately: display name, context
window, max output, input modalities, reasoning, thinking levels,
embedding dimension and picker visibility, each with its inherited
default and a layer comparison table.
- Add-model drawer, JSON editor with server-side change check before
publishing, and version history with one-step restore.
- Model settings gets a system-admin shortcut to the catalog; model
editor reloads providers when opened so published catalogs apply.
* fix(models): harden the admin model catalog console
- Reject console base_url, base_urls, url_patterns and auth: moving a
vendor's default URL would send its deployment api_key (and keys of rows
without their own base URL) to another host. With every interpolated
field now deployment-owned, '$' in names and descriptions is plain text.
- Drop deployment base URLs from catalog views; they may carry
interpolated tokens.
- Remember a stored version this replica cannot compile and skip it until
the version changes, instead of re-reading and recompiling every poll.
- Resolve vendor default thinking levels with reasoning forced on, like
per-model levels.
- Compute builtin/deployment views once; preview returns only the
candidate catalog and normalized overlay.
- Share deployment file lookup via runtime.ReadDeploymentOverlay.
- The model editor force-refreshes its own type instead of resetting the
provider store for every type; the refreshed list wins in the id index.
2026-09-24 08:31:45 +00:00
|
|
|
|
| 模型目录 | 查看目录模型及其来源,编辑、添加模型或用 JSON 批量修改(保存即生效),按版本历史恢复;详见[模型目录管理](06-models.md#系统管理员维护模型目录) | `/system/admin/model-catalog*` |
|
2026-08-06 10:22:10 +00:00
|
|
|
|
| 任务队列 | 查看 asynq 各队列实时积压、逐个任务的重试/归档/删除、批量清空归档任务;Lite 模式返回 `available=false` | `/system/admin/runtime/queues*` |
|
|
|
|
|
|
| 平台 API Key | 面向控制面自动化的 platform 作用域 Key,能力包括 `system_tenants_read/manage`、`system_settings_read/manage`、`system_runtime_read/manage`、`system_audit_read` | `/system/admin/api-keys` |
|
|
|
|
|
|
| 系统审计日志 | `tenant_id = 0` 的平台级事件(改设置、提升/撤销管理员、队列操作等)。空间级审计接口按 tenant 过滤,看不到这些行 | `GET /system/admin/audit-log` |
|
|
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
系统管理员还可执行以下操作:
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
|
|
|
|
|
- **重置用户密码**(`POST /system/admin/users/reset-password`):替换目标用户的本地密码并吊销其全部会话。**不能给自己重置**——自助改密码仍要求提供旧密码;
|
2026-09-08 02:54:41 +00:00
|
|
|
|
- **批量套用默认存储配额**(`POST /system/admin/tenants/apply-default-storage-quota`):把当前的默认配额写到所有已存在的空间上。该操作更新已有空间的配额数据。
|
|
|
|
|
|
|
|
|
|
|
|
### 创建用户
|
|
|
|
|
|
|
docs: sync website-docs, homepage and changelog for v0.8.2 (#3632)
* docs: sync website-docs with changes since v0.8.0
Audit every change between v0.8.0 and the v0.8.2 release against the
documentation site, adding what users and operators need and correcting
statements that no longer match the code.
- Add local browser (BrowserSkill), built-in MCP Server endpoints, the
toolbox, conversation steer/fork/rewind and reasoning effort, the
artifacts library, sandbox terminal and desktop, the Lite host sandbox,
the rebuilt model catalog (including a protocol-compat field reference),
Confluence and DingTalk Docs sources, Bocha/Serply search, per-channel IM
locale, whitelist-only outbound, admin user creation, new configuration
variables and migrations 000091-000110.
- Fix wrong API examples and parameters (model type values, knowledge
search params, FAQ match_count cap, Notion credentials), tenant deletion
semantics, default timeouts, parser engine claims, removed tables and
commands, stale navigation paths, and route locations after the router
split into routes_*.go.
- Add screenshots for the new pages and refresh outdated ones.
* fix(frontend): link the protocol-compat field to its documentation
The model editor told users to read catalog/compat.go on the backend, a
path that no longer exists after the model catalog refactor. The hint now
says when the override is needed and links to the field reference in
website-docs/03-features/06-models.md; the config examples and the API
type comment point to the same place.
* feat(website): showcase v0.8.2 on the homepage
- Add a v0.8.2 section for the local browser (BrowserSkill), the built-in
MCP Server and conversation control, and turn the v0.8.0 release block
into a standing skills & sandbox topic with the sandbox desktop and
terminal.
- Replace the three-up galleries with a feature list beside one large
screenshot: every item's text stays visible, clicking an item or one of
its views switches the image with a cross-fade, and the list plays itself
while on screen until the visitor picks something.
- Add Confluence, DingTalk, BrowserSkill and more model vendors to the
integrations, bump the header badge to v0.8.2 and link the changelog.
- check-site reports missing docs screenshots as pending instead of
failing, since the Screenshot component renders a placeholder for them.
* docs(changelog): add v0.8.2 release notes
* docs(website): add per-version release notes pages
Add a "版本发布" docs section with one page per release, starting with
v0.8.2 and a backfilled v0.8.0. Each page walks through the highlights
with the existing product screenshots, the other improvements and fixes,
and an upgrade checklist with the actions each breaking change needs.
The sidebar orders these pages by version, newest first; the docs header
gains a 版本 entry, and the homepage's v0.8.2 section now links to the
release notes page instead of the raw CHANGELOG.
* feat(website): let the site image listen on a configurable port
The Docker image hard-coded `listen 80`, so running it with host
networking or on a platform that assigns the container port required
editing the Nginx config and rebuilding. The image now renders its
config from the official nginx template directory at startup and reads
the listen port from `PORT` (default 80); deploy/nginx.conf stays a plain
config for static deployments.
test-docker starts a second container with PORT=8080 and checks the
rendered config and that the site answers on that port; the README
documents the variable.
* fix(website): namespace the nginx listen port variable
* fix(website): support bash-wrapped container startup
* fix(website): align nginx startup with frontend entrypoint
* fix(website): pin nginx runtime for older host compatibility
* fix(website): bake the configured nginx port into the image
2026-09-24 03:26:34 +00:00
|
|
|
|
自 v0.8.2 起,系统管理员可在「设置 → 系统设置 → 账户与访问」中点击「创建用户」开通本地账号:填写用户名(2–50 字符)和邮箱,保持「自动生成随机密码」开启,或关闭后手动填写符合密码策略的密码。适用于关闭公开注册后由管理员统一开户的场景。空间分配遵循 `auth.default_tenant_mode`:`create_personal` 创建个人空间,`tenantless` 等待用户加入空间。
|
2026-09-08 02:54:41 +00:00
|
|
|
|
|
docs: sync website-docs, homepage and changelog for v0.8.2 (#3632)
* docs: sync website-docs with changes since v0.8.0
Audit every change between v0.8.0 and the v0.8.2 release against the
documentation site, adding what users and operators need and correcting
statements that no longer match the code.
- Add local browser (BrowserSkill), built-in MCP Server endpoints, the
toolbox, conversation steer/fork/rewind and reasoning effort, the
artifacts library, sandbox terminal and desktop, the Lite host sandbox,
the rebuilt model catalog (including a protocol-compat field reference),
Confluence and DingTalk Docs sources, Bocha/Serply search, per-channel IM
locale, whitelist-only outbound, admin user creation, new configuration
variables and migrations 000091-000110.
- Fix wrong API examples and parameters (model type values, knowledge
search params, FAQ match_count cap, Notion credentials), tenant deletion
semantics, default timeouts, parser engine claims, removed tables and
commands, stale navigation paths, and route locations after the router
split into routes_*.go.
- Add screenshots for the new pages and refresh outdated ones.
* fix(frontend): link the protocol-compat field to its documentation
The model editor told users to read catalog/compat.go on the backend, a
path that no longer exists after the model catalog refactor. The hint now
says when the override is needed and links to the field reference in
website-docs/03-features/06-models.md; the config examples and the API
type comment point to the same place.
* feat(website): showcase v0.8.2 on the homepage
- Add a v0.8.2 section for the local browser (BrowserSkill), the built-in
MCP Server and conversation control, and turn the v0.8.0 release block
into a standing skills & sandbox topic with the sandbox desktop and
terminal.
- Replace the three-up galleries with a feature list beside one large
screenshot: every item's text stays visible, clicking an item or one of
its views switches the image with a cross-fade, and the list plays itself
while on screen until the visitor picks something.
- Add Confluence, DingTalk, BrowserSkill and more model vendors to the
integrations, bump the header badge to v0.8.2 and link the changelog.
- check-site reports missing docs screenshots as pending instead of
failing, since the Screenshot component renders a placeholder for them.
* docs(changelog): add v0.8.2 release notes
* docs(website): add per-version release notes pages
Add a "版本发布" docs section with one page per release, starting with
v0.8.2 and a backfilled v0.8.0. Each page walks through the highlights
with the existing product screenshots, the other improvements and fixes,
and an upgrade checklist with the actions each breaking change needs.
The sidebar orders these pages by version, newest first; the docs header
gains a 版本 entry, and the homepage's v0.8.2 section now links to the
release notes page instead of the raw CHANGELOG.
* feat(website): let the site image listen on a configurable port
The Docker image hard-coded `listen 80`, so running it with host
networking or on a platform that assigns the container port required
editing the Nginx config and rebuilding. The image now renders its
config from the official nginx template directory at startup and reads
the listen port from `PORT` (default 80); deploy/nginx.conf stays a plain
config for static deployments.
test-docker starts a second container with PORT=8080 and checks the
rendered config and that the site answers on that port; the README
documents the variable.
* fix(website): namespace the nginx listen port variable
* fix(website): support bash-wrapped container startup
* fix(website): align nginx startup with frontend entrypoint
* fix(website): pin nginx runtime for older host compatibility
* fix(website): bake the configured nginx port into the image
2026-09-24 03:26:34 +00:00
|
|
|
|
<Screenshot
|
|
|
|
|
|
src="/screenshots/system-admin-create-user.png"
|
|
|
|
|
|
caption="系统管理员创建用户:填写账号信息与一次性密码展示"
|
|
|
|
|
|
hint="「设置 → 系统设置 → 账户与访问」下打开「创建用户」对话框,展示用户名、邮箱与「自动生成随机密码」开关;可另附创建成功后显示一次性密码和「复制账号信息」按钮的结果页。" />
|
|
|
|
|
|
|
|
|
|
|
|
自动生成的密码仅在本次创建结果显示,应当场复制完整账号信息;确认前对话框不能关闭,关闭后不能再次查询明文。每次创建都会写入系统审计日志(`system.user_created`)。重复身份返回已有用户,不改密码;邮箱和用户名分别指向不同用户时拒绝创建。接口见[系统 API](../04-api/02-api-system.md)。
|
2026-09-08 02:54:41 +00:00
|
|
|
|
|
|
|
|
|
|
创建用户与首个管理员引导是不同操作:bootstrap 仍只提升已存在用户,不负责创建账号。
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
## 运行时设置参考 {#_3-运行时可改的系统设置}
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
支持的运行时设置可在控制台中修改。数据库中的设置值优先于环境变量,多数立即生效;影响新资源或需重建运行时的设置以表中说明为准。
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
|
|
|
|
|
| 键 | 类型 | 默认 | 生效时机 |
|
|
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
|
|
| `auth.registration_mode` | `self_serve` / `invite_only` | `self_serve` | 立即 |
|
|
|
|
|
|
| `auth.default_tenant_mode` | `create_personal` / `tenantless` | `create_personal` | 只影响之后注册的新用户 |
|
|
|
|
|
|
| `tenant.self_service_creation_enabled` | bool | `true` | 立即 |
|
|
|
|
|
|
| `tenant.max_owned_per_user` | int | `10`(0 = 用内置默认,负数 = 关闭限额) | 每次建空间时读取 |
|
|
|
|
|
|
| `tenant.default_storage_quota_gb` | int | `10` | **仅新建空间时读取**,不回写已有空间 |
|
|
|
|
|
|
| `tenant.auto_create_api_key` | bool | `false` | 每次建空间时读取 |
|
|
|
|
|
|
| `ssrf.whitelist` | 字符串列表 | 空 | 立即(`SSRF_WHITELIST_EXTRA` 仍只由部署方维护,不在此覆盖) |
|
|
|
|
|
|
| `asynq.core/postprocess/enrichment/maintenance/shared/wiki_concurrency` | int | 见[异步任务系统](../02-architecture/05-async-tasks.md) | 各 worker pool 重新装配 |
|
|
|
|
|
|
| `model.max_concurrency` | int | `32` | 立即 |
|
|
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
以下开关同样遵循数据库优先规则:
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
| 键 | 默认 | 作用 |
|
|
|
|
|
|
| --- | --- | --- |
|
|
|
|
|
|
| `auth.complex_password_enabled` | false | 新注册/新密码要求大小写字母、数字和特殊字符 |
|
|
|
|
|
|
| `tenant.auto_accept_invitation` | false | 邮箱邀请已注册用户时直接写入成员关系 |
|
|
|
|
|
|
| `sandbox.docker_enabled` | false | 开放 Docker 沙箱配置和实例创建 |
|
|
|
|
|
|
|
|
|
|
|
|
`tenant.auto_create_api_key` 默认关闭。依赖旧版注册响应的集成可启用此兼容开关,使新空间自动创建 full-access Key 并返回明文。
|
|
|
|
|
|
|
|
|
|
|
|
::: tip 重置运行时设置
|
|
|
|
|
|
控制台保存设置后,修改对应环境变量不会覆盖数据库值。排查配置未生效时,先检查运行时设置;重置(`DELETE /system/admin/settings/:key`)会删除数据库覆盖值,恢复使用环境变量或内置默认值。
|
2026-08-06 10:22:10 +00:00
|
|
|
|
:::
|
|
|
|
|
|
|
2026-09-08 02:54:41 +00:00
|
|
|
|
## 相关文档 {#相关}
|
2026-08-06 10:22:10 +00:00
|
|
|
|
|
|
|
|
|
|
- 空间内的四级角色与 API Key:[租户、用户与认证授权](01-tenant-auth.md)
|
|
|
|
|
|
- 队列拓扑与 worker pool:[异步任务系统](../02-architecture/05-async-tasks.md)
|
|
|
|
|
|
- 审计日志与追踪:[可观测性与审计](16-observability.md)
|
2026-09-08 02:54:41 +00:00
|
|
|
|
- 接口清单:[系统与平台管理 API](../04-api/02-api-system.md)
|
|
|
|
|
|
|
|
|
|
|
|
## 实现参考
|
|
|
|
|
|
|
|
|
|
|
|
- `cmd/server/bootstrap.go`:首个系统管理员引导。
|
|
|
|
|
|
- `frontend/src/config/settingsAccess.ts`:平台设置分区。
|
|
|
|
|
|
- `internal/application/service/system_setting.go`:运行时设置注册表。
|