feat(storage): add storage backend management API and UI enhancements
Implement a comprehensive API for managing storage backends, including endpoints for listing, creating, updating, and deleting storage instances. Enhance the UI to support multi-instance configurations, allowing users to manage multiple storage types effectively. Update localization files for new storage backend features and improve error handling for connectivity tests. This update also includes detailed documentation for the storage backend API.
This commit is contained in:
@@ -89,5 +89,6 @@ WeKnora API 按功能分为以下几类:
|
||||
| Skills | 预装智能体技能 | [skill.md](./skill.md) |
|
||||
| 网络搜索 | 网络搜索服务商 | [web-search.md](./web-search.md) |
|
||||
| 向量存储 | 向量数据库连接管理 | [vector-store.md](./vector-store.md) |
|
||||
| 存储后端 | 对象/文件存储实例(多实例)管理 | [storage-backend.md](./storage-backend.md) |
|
||||
| IM 渠道 | 企业微信 / 飞书 / Slack 等 IM 平台对接,含渠道 CRUD 与回调 | [../IM集成开发文档.md](../IM集成开发文档.md) |
|
||||
| 数据源导入 | 飞书 / 企微 / Notion / Confluence 等外部数据源接入与同步 | [../数据源导入开发文档.md](../数据源导入开发文档.md) |
|
||||
|
||||
@@ -0,0 +1,341 @@
|
||||
# Storage Backend API
|
||||
|
||||
[返回目录](./README.md)
|
||||
|
||||
存储后端(StorageBackend)API 用于管理空间的对象/文件存储实例。一个空间可以注册多个存储实例(`local`、`minio`、`cos`、`tos`、`s3`、`oss`、`ks3`、`obs`),并将不同知识库绑定到不同实例;空间维度还有一个默认实例(`default_storage_backend_id`),未显式绑定的新知识库使用该默认实例。
|
||||
|
||||
接口同时管理用户创建的实例(`source: "user"`)以及从环境变量快照生成的只读实例(`source: "env"`)。存储后端 CRUD 需要 **Admin+** 角色;对 API Key 需具备 `manage_storage_backends` capability(或 full-access)。
|
||||
|
||||
| 方法 | 路径 | 描述 | 最低权限 |
|
||||
| ------ | --------------------------------- | -------------------------------------- | -------- |
|
||||
| GET | `/storage-backends/types` | 获取 `STORAGE_ALLOW_LIST` 允许的存储类型 | Viewer+ |
|
||||
| POST | `/storage-backends/test` | 使用原始配置测试连通性(不落库) | Admin+ |
|
||||
| POST | `/storage-backends` | 创建存储实例 | Admin+ |
|
||||
| GET | `/storage-backends` | 获取存储实例列表 | Viewer+ |
|
||||
| GET | `/storage-backends/:id` | 获取存储实例详情 | Viewer+ |
|
||||
| PUT | `/storage-backends/:id` | 更新存储实例(名称/凭据/状态) | Admin+ |
|
||||
| DELETE | `/storage-backends/:id` | 删除存储实例(软删除) | Admin+ |
|
||||
| POST | `/storage-backends/:id/test` | 测试已保存实例的连通性 | Admin+ |
|
||||
| PUT | `/storage-backends/:id/default` | 设为空间默认存储实例 | Admin+ |
|
||||
|
||||
> 所有响应中的敏感字段(`access_key_id`、`secret_access_key`)都会被掩码。更新时若提交掩码占位符,则保留库中原有的真实凭据,不会被占位符覆盖。
|
||||
|
||||
## 存储配置字段(`config`)
|
||||
|
||||
不同 provider 使用同一套归一化的配置对象,按 provider 取用其中的子集:
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
| ------------------- | ------- | ------------------------------------------------------------- |
|
||||
| mode | string | MinIO 模式:`docker`(复用环境变量凭据)或 `remote` |
|
||||
| endpoint | string | 对象存储 endpoint(COS 使用 region,不需要 endpoint) |
|
||||
| region | string | 区域 |
|
||||
| access_key_id | string | 访问密钥 ID(COS 对应 SecretID);响应中掩码 |
|
||||
| secret_access_key | string | 访问密钥 Secret(COS 对应 SecretKey);响应中掩码 |
|
||||
| bucket_name | string | Bucket 名称 |
|
||||
| path_prefix | string | 对象前缀,必须为相对路径,禁止 `/` 开头或 `..` 上跳 |
|
||||
| app_id | string | 腾讯云 COS AppID |
|
||||
| use_ssl | boolean | 是否使用 SSL |
|
||||
| force_path_style | boolean | S3 是否使用 path-style 寻址 |
|
||||
| use_temp_bucket | boolean | OSS 是否使用临时 bucket |
|
||||
| temp_bucket_name | string | 临时 bucket 名称 |
|
||||
| temp_region | string | 临时 bucket 区域 |
|
||||
|
||||
> `endpoint`、`region`、`bucket_name`、`path_prefix` 决定对象的物理位置,**创建后不可变更**(更新时会被拒绝);如需迁移请使用存储迁移流程。凭据可通过更新单独轮换。
|
||||
|
||||
## GET `/storage-backends/types` - 获取允许的存储类型
|
||||
|
||||
返回 `STORAGE_ALLOW_LIST` 允许的 provider 列表,可用于前端动态表单生成。
|
||||
|
||||
**请求**:
|
||||
|
||||
```curl
|
||||
curl --location 'http://localhost:8080/api/v1/storage-backends/types' \
|
||||
--header 'X-API-Key: sk-xxxxx'
|
||||
```
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": ["local", "minio", "cos", "s3"]
|
||||
}
|
||||
```
|
||||
|
||||
## POST `/storage-backends/test` - 使用原始配置测试连通性
|
||||
|
||||
用前端表单中尚未保存的配置执行一次连通性测试,不会写入数据库。
|
||||
|
||||
**参数说明(请求体)**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
| -------- | ------ | ---- | ------------------------------------------- |
|
||||
| name | string | 是 | 实例显示名 |
|
||||
| provider | string | 是 | 存储类型,取自 `/storage-backends/types` |
|
||||
| config | object | 否 | 该 provider 对应的存储配置字段 |
|
||||
|
||||
**请求**:
|
||||
|
||||
```curl
|
||||
curl --location --request POST 'http://localhost:8080/api/v1/storage-backends/test' \
|
||||
--header 'X-API-Key: sk-xxxxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"name": "s3-hot",
|
||||
"provider": "s3",
|
||||
"config": {
|
||||
"endpoint": "https://s3.example.com",
|
||||
"region": "ap-test-1",
|
||||
"access_key_id": "AKID",
|
||||
"secret_access_key": "SECRET",
|
||||
"bucket_name": "weknora"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
**响应(成功)**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
**响应(失败)**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"error": "连接被拒绝,请确认服务已启动且端口正确"
|
||||
}
|
||||
```
|
||||
|
||||
> 测试失败时 HTTP 状态码仍为 `200`,错误信息通过 `success: false` + `error` 返回;`error` 已脱敏,不会泄漏内部主机名、IP、端口或 TLS 细节。
|
||||
|
||||
## POST `/storage-backends` - 创建存储实例
|
||||
|
||||
为当前空间创建一个新的存储实例。创建前会先校验配置、执行 SSRF 校验(本地存储与 docker 模式 MinIO 除外),并执行一次连通性测试;任一环节失败都会返回 `400`。同一空间内实例名称不允许重复。
|
||||
|
||||
**参数说明(请求体)**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
| -------- | ------ | ---- | ------------------------------------------- |
|
||||
| name | string | 是 | 实例显示名(空间内唯一) |
|
||||
| provider | string | 是 | 存储类型,取自 `/storage-backends/types` |
|
||||
| config | object | 否 | 该 provider 对应的存储配置字段 |
|
||||
| status | string | 否 | `active`(默认)或 `disabled` |
|
||||
|
||||
**请求**:
|
||||
|
||||
```curl
|
||||
curl --location 'http://localhost:8080/api/v1/storage-backends' \
|
||||
--header 'X-API-Key: sk-xxxxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"name": "s3-hot",
|
||||
"provider": "s3",
|
||||
"config": {
|
||||
"endpoint": "https://s3.example.com",
|
||||
"region": "ap-test-1",
|
||||
"access_key_id": "AKID",
|
||||
"secret_access_key": "SECRET",
|
||||
"bucket_name": "weknora",
|
||||
"path_prefix": "prod"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
**响应** (201):
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"name": "s3-hot",
|
||||
"provider": "s3",
|
||||
"config": {
|
||||
"endpoint": "https://s3.example.com",
|
||||
"region": "ap-test-1",
|
||||
"access_key_id": "***",
|
||||
"secret_access_key": "***",
|
||||
"bucket_name": "weknora",
|
||||
"path_prefix": "prod"
|
||||
},
|
||||
"source": "user",
|
||||
"status": "active",
|
||||
"legacy_alias": false,
|
||||
"created_at": "2026-07-15T10:00:00Z",
|
||||
"updated_at": "2026-07-15T10:00:00Z"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## GET `/storage-backends` - 获取存储实例列表
|
||||
|
||||
返回当前空间的所有存储实例(凭据已掩码),并在顶层返回空间默认实例 id。
|
||||
|
||||
**请求**:
|
||||
|
||||
```curl
|
||||
curl --location 'http://localhost:8080/api/v1/storage-backends' \
|
||||
--header 'X-API-Key: sk-xxxxx'
|
||||
```
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": [
|
||||
{
|
||||
"id": "550e8400-e29b-41d4-a716-446655440000",
|
||||
"name": "s3-hot",
|
||||
"provider": "s3",
|
||||
"config": { "endpoint": "https://s3.example.com", "access_key_id": "***", "secret_access_key": "***", "bucket_name": "weknora" },
|
||||
"source": "user",
|
||||
"status": "active",
|
||||
"legacy_alias": false
|
||||
}
|
||||
],
|
||||
"default_storage_backend_id": "550e8400-e29b-41d4-a716-446655440000"
|
||||
}
|
||||
```
|
||||
|
||||
## GET `/storage-backends/:id` - 获取存储实例详情
|
||||
|
||||
根据 ID 获取当前空间下的单个存储实例,凭据已掩码。
|
||||
|
||||
**路径参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
| ---- | ------ | ---- | ------------- |
|
||||
| id | string | 是 | 存储实例 ID |
|
||||
|
||||
**请求**:
|
||||
|
||||
```curl
|
||||
curl --location 'http://localhost:8080/api/v1/storage-backends/550e8400-e29b-41d4-a716-446655440000' \
|
||||
--header 'X-API-Key: sk-xxxxx'
|
||||
```
|
||||
|
||||
## PUT `/storage-backends/:id` - 更新存储实例
|
||||
|
||||
更新实例的可变字段(`name`、凭据、`status`)。`provider` 与物理位置字段(`endpoint`、`region`、`bucket_name`、`path_prefix`)不可变更,尝试更改会返回 `400`。环境变量来源(`source: "env"`)的实例只读,不可更新。更新同样会执行校验与连通性测试。
|
||||
|
||||
> 若 `access_key_id` / `secret_access_key` 提交为掩码占位符(`***`),则保留库中原有真实凭据。
|
||||
|
||||
**禁用保护**:将当前为默认实例、或仍有知识库绑定的实例改为 `disabled` 会被拒绝(`400`)。
|
||||
|
||||
**路径参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
| ---- | ------ | ---- | ------------- |
|
||||
| id | string | 是 | 存储实例 ID |
|
||||
|
||||
**请求**:
|
||||
|
||||
```curl
|
||||
curl --location --request PUT 'http://localhost:8080/api/v1/storage-backends/550e8400-e29b-41d4-a716-446655440000' \
|
||||
--header 'X-API-Key: sk-xxxxx' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"name": "s3-hot-renamed",
|
||||
"provider": "s3",
|
||||
"config": {
|
||||
"access_key_id": "***",
|
||||
"secret_access_key": "NEW_SECRET"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
## DELETE `/storage-backends/:id` - 删除存储实例
|
||||
|
||||
对存储实例执行软删除。以下情况删除会被拒绝(`400`):实例是空间默认实例、仍有知识库绑定、环境变量来源(只读)、或为 legacy 别名(旧文件路径可能仍引用它)。删除在事务中执行;PostgreSQL 上对目标行加行锁以避免并发绑定竞态。
|
||||
|
||||
**路径参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
| ---- | ------ | ---- | ------------- |
|
||||
| id | string | 是 | 存储实例 ID |
|
||||
|
||||
**请求**:
|
||||
|
||||
```curl
|
||||
curl --location --request DELETE 'http://localhost:8080/api/v1/storage-backends/550e8400-e29b-41d4-a716-446655440000' \
|
||||
--header 'X-API-Key: sk-xxxxx'
|
||||
```
|
||||
|
||||
**响应(成功)**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
## POST `/storage-backends/:id/test` - 测试已保存实例的连通性
|
||||
|
||||
对已保存的存储实例用其存储的凭据执行一次连通性测试。
|
||||
|
||||
**路径参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
| ---- | ------ | ---- | ------------- |
|
||||
| id | string | 是 | 存储实例 ID |
|
||||
|
||||
**请求**:
|
||||
|
||||
```curl
|
||||
curl --location --request POST 'http://localhost:8080/api/v1/storage-backends/550e8400-e29b-41d4-a716-446655440000/test' \
|
||||
--header 'X-API-Key: sk-xxxxx'
|
||||
```
|
||||
|
||||
**响应(成功)**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
> 与 `/storage-backends/test` 一致,测试失败时 HTTP 状态码仍为 `200`,错误经脱敏后通过 `success: false` + `error` 返回。
|
||||
|
||||
## PUT `/storage-backends/:id/default` - 设为空间默认实例
|
||||
|
||||
将某个存储实例标记为空间默认实例。仅 `active` 状态的实例可以设为默认。未显式绑定存储实例的新知识库将使用默认实例。
|
||||
|
||||
**路径参数**:
|
||||
|
||||
| 字段 | 类型 | 必填 | 说明 |
|
||||
| ---- | ------ | ---- | ------------- |
|
||||
| id | string | 是 | 存储实例 ID |
|
||||
|
||||
**请求**:
|
||||
|
||||
```curl
|
||||
curl --location --request PUT 'http://localhost:8080/api/v1/storage-backends/550e8400-e29b-41d4-a716-446655440000/default' \
|
||||
--header 'X-API-Key: sk-xxxxx'
|
||||
```
|
||||
|
||||
**响应**:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true
|
||||
}
|
||||
```
|
||||
|
||||
## 环境变量存储实例
|
||||
|
||||
通过 `STORAGE_TYPE` 等环境变量配置的存储会以只读实例(`source: "env"`、`legacy_alias: true`)形式参与实例解析,使 env-only 部署与用户管理的实例走同一套解析路径。这类实例在每次启动时按环境变量刷新,且不可通过 API 更新或删除。
|
||||
|
||||
## 错误码
|
||||
|
||||
| HTTP 状态码 | 含义 |
|
||||
| ----------- | ---------------------------------------------------------------- |
|
||||
| 400 | 请求参数错误、校验失败、SSRF 校验失败、连通性测试失败、尝试更改不可变字段、修改只读实例、删除受保护实例、禁用被引用实例、设为默认时实例非 active |
|
||||
| 401 | 未认证(缺少空间上下文或 API Key) |
|
||||
| 403 | 权限不足(需 Admin+ 或 API Key `manage_storage_backends` capability) |
|
||||
| 404 | 存储实例不存在 |
|
||||
| 409 | 同名存储实例已存在 |
|
||||
+551
-1
@@ -11077,6 +11077,468 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "List all storage backend instances for the current workspace, with credentials masked. The workspace default backend id is returned alongside the list.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "List storage backends",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of storage backends and default_storage_backend_id",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Register a new object/file storage instance for the current workspace. The configuration is validated and a connectivity test is run before the backend is persisted.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Create storage backend",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Storage backend configuration",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handler.storageBackendRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created storage backend",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request, validation, or connectivity test failure",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "A storage backend with this name already exists",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends/test": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Test connectivity for the provided storage configuration without persisting it. Returns success=false with a sanitized error message on failure (the HTTP status stays 200).",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Test storage backend with raw config",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Storage backend configuration to test",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handler.storageBackendRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Connectivity test result (success, error)",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request or validation error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends/types": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Return the storage provider types allowed by STORAGE_ALLOW_LIST for UI form generation (e.g. local, minio, cos, tos, s3, oss, ks3, obs).",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "List allowed storage provider types",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of allowed storage provider types",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Retrieve a single storage backend by ID for the current workspace. Credentials are masked.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Get storage backend",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Storage backend ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Storage backend details",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Storage backend not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Update a storage backend's mutable fields (name, credentials, status). Provider and physical location (endpoint, region, bucket, path prefix) are immutable; use storage migration to move data. Environment-sourced backends are read-only. Redacted secret placeholders preserve the stored credentials.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Update storage backend",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Storage backend ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Updated storage backend fields",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handler.storageBackendRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Updated storage backend",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Immutable field change, read-only backend, validation, or connectivity failure",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Storage backend not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Soft-delete a storage backend. A backend that is the workspace default, still bound to knowledge bases, environment-sourced, or a legacy alias cannot be deleted.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Delete storage backend",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Storage backend ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Deletion success",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Backend is default, bound, read-only, or legacy alias",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Storage backend not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends/{id}/default": {
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Mark a storage backend as the workspace default. Only an active backend can become the default. New knowledge bases without an explicit binding use the default.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Set default storage backend",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Storage backend ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Default set successfully",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Backend is not active",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Storage backend not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends/{id}/test": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Test connectivity of an existing saved storage backend using its stored credentials. Returns success=false with a sanitized error message on failure (the HTTP status stays 200).",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Test storage backend by ID",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Storage backend ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Connectivity test result (success, error)",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Storage backend not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/system/admin/audit-log": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -14387,6 +14849,12 @@ const docTemplate = `{
|
||||
},
|
||||
"secret_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_bucket_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_region": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -15718,6 +16186,10 @@ const docTemplate = `{
|
||||
"description": "ShareCount indicates the number of organizations this knowledge base is shared with (not stored in database)",
|
||||
"type": "integer"
|
||||
},
|
||||
"storage_backend_id": {
|
||||
"description": "StorageBackendID binds this KB to one concrete storage instance. The\nlegacy provider field remains readable during migration only.",
|
||||
"type": "string"
|
||||
},
|
||||
"storage_config": {
|
||||
"description": "Deprecated: legacy COS config column. Kept for backward compatibility with old data.",
|
||||
"allOf": [
|
||||
@@ -17888,6 +18360,50 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.StorageBackendConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_key_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"app_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"bucket_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"endpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"force_path_style": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"mode": {
|
||||
"type": "string"
|
||||
},
|
||||
"path_prefix": {
|
||||
"type": "string"
|
||||
},
|
||||
"region": {
|
||||
"type": "string"
|
||||
},
|
||||
"secret_access_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_bucket_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_region": {
|
||||
"type": "string"
|
||||
},
|
||||
"use_ssl": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"use_temp_bucket": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.StorageConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -18159,6 +18675,12 @@ const docTemplate = `{
|
||||
},
|
||||
"secret_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_bucket_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_region": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -18197,6 +18719,10 @@ const docTemplate = `{
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_storage_backend_id": {
|
||||
"description": "DefaultStorageBackendID is the workspace default concrete storage instance.",
|
||||
"type": "string"
|
||||
},
|
||||
"deleted_at": {
|
||||
"description": "Deletion time",
|
||||
"allOf": [
|
||||
@@ -19993,6 +20519,9 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageBackendId": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageProvider": {
|
||||
"description": "存储引擎选择(\"local\" | \"minio\" | \"cos\"),影响文档上传与文档内图片存储,参数从全局设置读取",
|
||||
"type": "string"
|
||||
@@ -20516,7 +21045,7 @@ const docTemplate = `{
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "\"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\"",
|
||||
"description": "\"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\", \"obs\"",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -20923,6 +21452,27 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.storageBackendRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"provider"
|
||||
],
|
||||
"properties": {
|
||||
"config": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.StorageBackendConfig"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"provider": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.updateLastFAQImportResultDisplayStatusRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
+551
-1
@@ -11070,6 +11070,468 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "List all storage backend instances for the current workspace, with credentials masked. The workspace default backend id is returned alongside the list.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "List storage backends",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of storage backends and default_storage_backend_id",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Register a new object/file storage instance for the current workspace. The configuration is validated and a connectivity test is run before the backend is persisted.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Create storage backend",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Storage backend configuration",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handler.storageBackendRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created storage backend",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request, validation, or connectivity test failure",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "A storage backend with this name already exists",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends/test": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Test connectivity for the provided storage configuration without persisting it. Returns success=false with a sanitized error message on failure (the HTTP status stays 200).",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Test storage backend with raw config",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Storage backend configuration to test",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handler.storageBackendRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Connectivity test result (success, error)",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request or validation error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends/types": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Return the storage provider types allowed by STORAGE_ALLOW_LIST for UI form generation (e.g. local, minio, cos, tos, s3, oss, ks3, obs).",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "List allowed storage provider types",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "List of allowed storage provider types",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Retrieve a single storage backend by ID for the current workspace. Credentials are masked.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Get storage backend",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Storage backend ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Storage backend details",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Storage backend not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Update a storage backend's mutable fields (name, credentials, status). Provider and physical location (endpoint, region, bucket, path prefix) are immutable; use storage migration to move data. Environment-sourced backends are read-only. Redacted secret placeholders preserve the stored credentials.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Update storage backend",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Storage backend ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Updated storage backend fields",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/internal_handler.storageBackendRequest"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Updated storage backend",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Immutable field change, read-only backend, validation, or connectivity failure",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Storage backend not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Soft-delete a storage backend. A backend that is the workspace default, still bound to knowledge bases, environment-sourced, or a legacy alias cannot be deleted.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Delete storage backend",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Storage backend ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Deletion success",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Backend is default, bound, read-only, or legacy alias",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Storage backend not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends/{id}/default": {
|
||||
"put": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Mark a storage backend as the workspace default. Only an active backend can become the default. New knowledge bases without an explicit binding use the default.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Set default storage backend",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Storage backend ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Default set successfully",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Backend is not active",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Storage backend not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/storage-backends/{id}/test": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"Bearer": []
|
||||
},
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Test connectivity of an existing saved storage backend using its stored credentials. Returns success=false with a sanitized error message on failure (the HTTP status stays 200).",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"StorageBackend"
|
||||
],
|
||||
"summary": "Test storage backend by ID",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Storage backend ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Connectivity test result (success, error)",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Storage backend not found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/system/admin/audit-log": {
|
||||
"get": {
|
||||
"security": [
|
||||
@@ -14380,6 +14842,12 @@
|
||||
},
|
||||
"secret_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_bucket_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_region": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -15711,6 +16179,10 @@
|
||||
"description": "ShareCount indicates the number of organizations this knowledge base is shared with (not stored in database)",
|
||||
"type": "integer"
|
||||
},
|
||||
"storage_backend_id": {
|
||||
"description": "StorageBackendID binds this KB to one concrete storage instance. The\nlegacy provider field remains readable during migration only.",
|
||||
"type": "string"
|
||||
},
|
||||
"storage_config": {
|
||||
"description": "Deprecated: legacy COS config column. Kept for backward compatibility with old data.",
|
||||
"allOf": [
|
||||
@@ -17881,6 +18353,50 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.StorageBackendConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_key_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"app_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"bucket_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"endpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"force_path_style": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"mode": {
|
||||
"type": "string"
|
||||
},
|
||||
"path_prefix": {
|
||||
"type": "string"
|
||||
},
|
||||
"region": {
|
||||
"type": "string"
|
||||
},
|
||||
"secret_access_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_bucket_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_region": {
|
||||
"type": "string"
|
||||
},
|
||||
"use_ssl": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"use_temp_bucket": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"github_com_Tencent_WeKnora_internal_types.StorageConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -18152,6 +18668,12 @@
|
||||
},
|
||||
"secret_key": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_bucket_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"temp_region": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -18190,6 +18712,10 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"default_storage_backend_id": {
|
||||
"description": "DefaultStorageBackendID is the workspace default concrete storage instance.",
|
||||
"type": "string"
|
||||
},
|
||||
"deleted_at": {
|
||||
"description": "Deletion time",
|
||||
"allOf": [
|
||||
@@ -19986,6 +20512,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageBackendId": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageProvider": {
|
||||
"description": "存储引擎选择(\"local\" | \"minio\" | \"cos\"),影响文档上传与文档内图片存储,参数从全局设置读取",
|
||||
"type": "string"
|
||||
@@ -20509,7 +21038,7 @@
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "\"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\"",
|
||||
"description": "\"local\", \"minio\", \"cos\", \"tos\", \"s3\", \"oss\", \"ks3\", \"obs\"",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
@@ -20916,6 +21445,27 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.storageBackendRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"provider"
|
||||
],
|
||||
"properties": {
|
||||
"config": {
|
||||
"$ref": "#/definitions/github_com_Tencent_WeKnora_internal_types.StorageBackendConfig"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"provider": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"internal_handler.updateLastFAQImportResultDisplayStatusRequest": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
||||
+371
-1
@@ -377,6 +377,10 @@ definitions:
|
||||
type: string
|
||||
secret_key:
|
||||
type: string
|
||||
temp_bucket_name:
|
||||
type: string
|
||||
temp_region:
|
||||
type: string
|
||||
type: object
|
||||
github_com_Tencent_WeKnora_internal_types.ChatHistoryConfig:
|
||||
properties:
|
||||
@@ -1461,6 +1465,11 @@ definitions:
|
||||
description: ShareCount indicates the number of organizations this knowledge
|
||||
base is shared with (not stored in database)
|
||||
type: integer
|
||||
storage_backend_id:
|
||||
description: |-
|
||||
StorageBackendID binds this KB to one concrete storage instance. The
|
||||
legacy provider field remains readable during migration only.
|
||||
type: string
|
||||
storage_config:
|
||||
allOf:
|
||||
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.StorageConfig'
|
||||
@@ -3080,6 +3089,35 @@ definitions:
|
||||
mode:
|
||||
type: string
|
||||
type: object
|
||||
github_com_Tencent_WeKnora_internal_types.StorageBackendConfig:
|
||||
properties:
|
||||
access_key_id:
|
||||
type: string
|
||||
app_id:
|
||||
type: string
|
||||
bucket_name:
|
||||
type: string
|
||||
endpoint:
|
||||
type: string
|
||||
force_path_style:
|
||||
type: boolean
|
||||
mode:
|
||||
type: string
|
||||
path_prefix:
|
||||
type: string
|
||||
region:
|
||||
type: string
|
||||
secret_access_key:
|
||||
type: string
|
||||
temp_bucket_name:
|
||||
type: string
|
||||
temp_region:
|
||||
type: string
|
||||
use_ssl:
|
||||
type: boolean
|
||||
use_temp_bucket:
|
||||
type: boolean
|
||||
type: object
|
||||
github_com_Tencent_WeKnora_internal_types.StorageConfig:
|
||||
properties:
|
||||
app_id:
|
||||
@@ -3292,6 +3330,10 @@ definitions:
|
||||
type: string
|
||||
secret_key:
|
||||
type: string
|
||||
temp_bucket_name:
|
||||
type: string
|
||||
temp_region:
|
||||
type: string
|
||||
type: object
|
||||
github_com_Tencent_WeKnora_internal_types.Tenant:
|
||||
properties:
|
||||
@@ -3316,6 +3358,10 @@ definitions:
|
||||
- $ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.CredentialsConfig'
|
||||
description: 'Credentials config: third-party provider credentials (e.g. WeKnoraCloud
|
||||
AppID/AppSecret)'
|
||||
default_storage_backend_id:
|
||||
description: DefaultStorageBackendID is the workspace default concrete storage
|
||||
instance.
|
||||
type: string
|
||||
deleted_at:
|
||||
allOf:
|
||||
- $ref: '#/definitions/gorm.DeletedAt'
|
||||
@@ -4651,6 +4697,8 @@ definitions:
|
||||
questionCount:
|
||||
type: integer
|
||||
type: object
|
||||
storageBackendId:
|
||||
type: string
|
||||
storageProvider:
|
||||
description: 存储引擎选择("local" | "minio" | "cos"),影响文档上传与文档内图片存储,参数从全局设置读取
|
||||
type: string
|
||||
@@ -5024,7 +5072,7 @@ definitions:
|
||||
description: short description for UI
|
||||
type: string
|
||||
name:
|
||||
description: '"local", "minio", "cos", "tos", "s3", "oss", "ks3"'
|
||||
description: '"local", "minio", "cos", "tos", "s3", "oss", "ks3", "obs"'
|
||||
type: string
|
||||
type: object
|
||||
internal_handler.SuggestionEventRequest:
|
||||
@@ -5295,6 +5343,20 @@ definitions:
|
||||
type: string
|
||||
type: array
|
||||
type: object
|
||||
internal_handler.storageBackendRequest:
|
||||
properties:
|
||||
config:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_types.StorageBackendConfig'
|
||||
name:
|
||||
type: string
|
||||
provider:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
- provider
|
||||
type: object
|
||||
internal_handler.updateLastFAQImportResultDisplayStatusRequest:
|
||||
properties:
|
||||
display_status:
|
||||
@@ -12553,6 +12615,314 @@ paths:
|
||||
summary: 获取预装Skills列表
|
||||
tags:
|
||||
- Skills
|
||||
/storage-backends:
|
||||
get:
|
||||
description: List all storage backend instances for the current workspace, with
|
||||
credentials masked. The workspace default backend id is returned alongside
|
||||
the list.
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: List of storage backends and default_storage_backend_id
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
- ApiKeyAuth: []
|
||||
summary: List storage backends
|
||||
tags:
|
||||
- StorageBackend
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Register a new object/file storage instance for the current workspace.
|
||||
The configuration is validated and a connectivity test is run before the backend
|
||||
is persisted.
|
||||
parameters:
|
||||
- description: Storage backend configuration
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handler.storageBackendRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created storage backend
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"400":
|
||||
description: Invalid request, validation, or connectivity test failure
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"409":
|
||||
description: A storage backend with this name already exists
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
|
||||
security:
|
||||
- Bearer: []
|
||||
- ApiKeyAuth: []
|
||||
summary: Create storage backend
|
||||
tags:
|
||||
- StorageBackend
|
||||
/storage-backends/{id}:
|
||||
delete:
|
||||
description: Soft-delete a storage backend. A backend that is the workspace
|
||||
default, still bound to knowledge bases, environment-sourced, or a legacy
|
||||
alias cannot be deleted.
|
||||
parameters:
|
||||
- description: Storage backend ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Deletion success
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"400":
|
||||
description: Backend is default, bound, read-only, or legacy alias
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"404":
|
||||
description: Storage backend not found
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
|
||||
security:
|
||||
- Bearer: []
|
||||
- ApiKeyAuth: []
|
||||
summary: Delete storage backend
|
||||
tags:
|
||||
- StorageBackend
|
||||
get:
|
||||
description: Retrieve a single storage backend by ID for the current workspace.
|
||||
Credentials are masked.
|
||||
parameters:
|
||||
- description: Storage backend ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Storage backend details
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"404":
|
||||
description: Storage backend not found
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
|
||||
security:
|
||||
- Bearer: []
|
||||
- ApiKeyAuth: []
|
||||
summary: Get storage backend
|
||||
tags:
|
||||
- StorageBackend
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Update a storage backend's mutable fields (name, credentials, status).
|
||||
Provider and physical location (endpoint, region, bucket, path prefix) are
|
||||
immutable; use storage migration to move data. Environment-sourced backends
|
||||
are read-only. Redacted secret placeholders preserve the stored credentials.
|
||||
parameters:
|
||||
- description: Storage backend ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Updated storage backend fields
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handler.storageBackendRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Updated storage backend
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"400":
|
||||
description: Immutable field change, read-only backend, validation, or connectivity
|
||||
failure
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"404":
|
||||
description: Storage backend not found
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
|
||||
security:
|
||||
- Bearer: []
|
||||
- ApiKeyAuth: []
|
||||
summary: Update storage backend
|
||||
tags:
|
||||
- StorageBackend
|
||||
/storage-backends/{id}/default:
|
||||
put:
|
||||
description: Mark a storage backend as the workspace default. Only an active
|
||||
backend can become the default. New knowledge bases without an explicit binding
|
||||
use the default.
|
||||
parameters:
|
||||
- description: Storage backend ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Default set successfully
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"400":
|
||||
description: Backend is not active
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"404":
|
||||
description: Storage backend not found
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
|
||||
security:
|
||||
- Bearer: []
|
||||
- ApiKeyAuth: []
|
||||
summary: Set default storage backend
|
||||
tags:
|
||||
- StorageBackend
|
||||
/storage-backends/{id}/test:
|
||||
post:
|
||||
description: Test connectivity of an existing saved storage backend using its
|
||||
stored credentials. Returns success=false with a sanitized error message on
|
||||
failure (the HTTP status stays 200).
|
||||
parameters:
|
||||
- description: Storage backend ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Connectivity test result (success, error)
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"404":
|
||||
description: Storage backend not found
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
|
||||
security:
|
||||
- Bearer: []
|
||||
- ApiKeyAuth: []
|
||||
summary: Test storage backend by ID
|
||||
tags:
|
||||
- StorageBackend
|
||||
/storage-backends/test:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Test connectivity for the provided storage configuration without
|
||||
persisting it. Returns success=false with a sanitized error message on failure
|
||||
(the HTTP status stays 200).
|
||||
parameters:
|
||||
- description: Storage backend configuration to test
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/internal_handler.storageBackendRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Connectivity test result (success, error)
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
"400":
|
||||
description: Invalid request or validation error
|
||||
schema:
|
||||
$ref: '#/definitions/github_com_Tencent_WeKnora_internal_errors.AppError'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
- ApiKeyAuth: []
|
||||
summary: Test storage backend with raw config
|
||||
tags:
|
||||
- StorageBackend
|
||||
/storage-backends/types:
|
||||
get:
|
||||
description: Return the storage provider types allowed by STORAGE_ALLOW_LIST
|
||||
for UI form generation (e.g. local, minio, cos, tos, s3, oss, ks3, obs).
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: List of allowed storage provider types
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
- ApiKeyAuth: []
|
||||
summary: List allowed storage provider types
|
||||
tags:
|
||||
- StorageBackend
|
||||
/system/admin/audit-log:
|
||||
get:
|
||||
description: 返回 system-scope(tenant_id=0)的审计事件,覆盖 system.setting_changed / system.admin_promoted
|
||||
|
||||
Reference in New Issue
Block a user