docs(api): 补全 OpenAPI 上传与系统设置文档

为文件上传、静态资源和文件存储设置接口补齐注释,并同步更新生成的 Swagger 文档。
This commit is contained in:
2026-05-15 09:59:25 +08:00
parent 62d426bdfb
commit 34c3251c6d
6 changed files with 1300 additions and 0 deletions
+710
View File
@@ -2357,6 +2357,355 @@
}
}
},
"/api/admin/system/file-storage/channels": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "返回所有未删除的文件存储通道,用于管理上传与生成资源回传策略。",
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "列出文件存储通道",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/httpapi.FileStorageChannelListResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "创建文件存储通道,当前主要用于配置 server-main OpenAPI 上传通道。",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "创建文件存储通道",
"parameters": [
{
"description": "文件存储通道",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/store.FileStorageChannelInput"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/store.FileStorageChannel"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
}
},
"/api/admin/system/file-storage/channels/{channelID}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "软删除指定文件存储通道。",
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "删除文件存储通道",
"parameters": [
{
"type": "string",
"description": "文件存储通道 ID",
"name": "channelID",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "更新指定文件存储通道的名称、凭证、场景、优先级、状态和重试策略。",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "更新文件存储通道",
"parameters": [
{
"type": "string",
"description": "文件存储通道 ID",
"name": "channelID",
"in": "path",
"required": true
},
{
"description": "文件存储通道",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/store.FileStorageChannelInput"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/store.FileStorageChannel"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
}
},
"/api/admin/system/file-storage/settings": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "返回文件存储系统设置;数据库对象尚未创建时返回默认设置。",
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "获取文件存储设置",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/store.FileStorageSettings"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "更新生成资源上传策略等文件存储系统设置。",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"system"
],
"summary": "更新文件存储设置",
"parameters": [
{
"description": "文件存储设置",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/store.FileStorageSettingsInput"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/store.FileStorageSettings"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
}
},
"/api/admin/tenants": {
"get": {
"security": [
@@ -3737,6 +4086,74 @@
}
}
},
"/api/v1/files/upload": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "上传文件到配置的文件存储通道;没有启用通道时回退到本地静态上传目录。单文件最大 256MiB。",
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "上传文件",
"parameters": [
{
"type": "file",
"description": "要上传的文件",
"name": "file",
"in": "formData",
"required": true
},
{
"type": "string",
"default": "ai-gateway-openapi",
"description": "上传来源标识",
"name": "source",
"in": "formData"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/httpapi.FileUploadResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"502": {
"description": "Bad Gateway",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"503": {
"description": "Service Unavailable",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
}
},
"/api/v1/images/edits": {
"post": {
"security": [
@@ -5446,6 +5863,41 @@
}
}
},
"/static/generated/{asset}": {
"get": {
"description": "从本地生成资源目录读取图片、视频等任务产物;不存在时返回 404。",
"produces": [
"application/octet-stream"
],
"tags": [
"static"
],
"summary": "获取本地生成资源",
"parameters": [
{
"type": "string",
"description": "资源文件名",
"name": "asset",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/static/simulation/{asset}": {
"get": {
"description": "返回本地模拟模式使用的图片、视频封面或短视频资源。",
@@ -5482,6 +5934,41 @@
}
}
},
"/static/uploaded/{asset}": {
"get": {
"description": "从本地上传资源目录读取用户上传文件;不存在时返回 404。",
"produces": [
"application/octet-stream"
],
"tags": [
"static"
],
"summary": "获取本地上传资源",
"parameters": [
{
"type": "string",
"description": "资源文件名",
"name": "asset",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/v1/chat/completions": {
"post": {
"security": [
@@ -5575,6 +6062,74 @@
}
}
},
"/v1/files/upload": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "上传文件到配置的文件存储通道;没有启用通道时回退到本地静态上传目录。单文件最大 256MiB。",
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "上传文件",
"parameters": [
{
"type": "file",
"description": "要上传的文件",
"name": "file",
"in": "formData",
"required": true
},
{
"type": "string",
"default": "ai-gateway-openapi",
"description": "上传来源标识",
"name": "source",
"in": "formData"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/httpapi.FileUploadResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"502": {
"description": "Bad Gateway",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"503": {
"description": "Service Unavailable",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
}
},
"/v1/images/edits": {
"post": {
"security": [
@@ -6062,6 +6617,46 @@
}
}
},
"httpapi.FileStorageChannelListResponse": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/store.FileStorageChannel"
}
}
}
},
"httpapi.FileUploadResponse": {
"type": "object",
"properties": {
"assetStorage": {
"type": "object",
"additionalProperties": true
},
"contentType": {
"type": "string",
"example": "image/png"
},
"filename": {
"type": "string",
"example": "image.png"
},
"id": {
"type": "string",
"example": "file_abc123"
},
"size": {
"type": "integer",
"example": 1024
},
"url": {
"type": "string",
"example": "/static/uploaded/upload-abc123.png"
}
}
},
"httpapi.HealthResponse": {
"type": "object",
"properties": {
@@ -7407,6 +8002,121 @@
}
}
},
"store.FileStorageChannel": {
"type": "object",
"properties": {
"channelKey": {
"type": "string"
},
"config": {
"type": "object",
"additionalProperties": {}
},
"createdAt": {
"type": "string"
},
"credentialsPreview": {
"type": "object",
"additionalProperties": {}
},
"id": {
"type": "string"
},
"lastError": {
"type": "string"
},
"lastFailedAt": {
"type": "string"
},
"lastSucceededAt": {
"type": "string"
},
"name": {
"type": "string"
},
"priority": {
"type": "integer"
},
"provider": {
"type": "string"
},
"retryPolicy": {
"type": "object",
"additionalProperties": {}
},
"scenes": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string"
},
"updatedAt": {
"type": "string"
},
"uploadUrl": {
"type": "string"
}
}
},
"store.FileStorageChannelInput": {
"type": "object",
"properties": {
"apiKey": {
"type": "string"
},
"channelKey": {
"type": "string"
},
"config": {
"type": "object",
"additionalProperties": {}
},
"name": {
"type": "string"
},
"priority": {
"type": "integer"
},
"provider": {
"type": "string"
},
"retryPolicy": {
"type": "object",
"additionalProperties": {}
},
"scenes": {
"type": "array",
"items": {
"type": "string"
}
},
"status": {
"type": "string"
},
"uploadUrl": {
"type": "string"
}
}
},
"store.FileStorageSettings": {
"type": "object",
"properties": {
"resultUploadPolicy": {
"type": "string"
}
}
},
"store.FileStorageSettingsInput": {
"type": "object",
"properties": {
"resultUploadPolicy": {
"type": "string"
}
}
},
"store.GatewayTask": {
"type": "object",
"properties": {