fix: restore OpenAPI file uploads

Expose /api/v1/file in OpenAPI, enable file-scoped API keys, and regenerate docs/client artifacts.
This commit is contained in:
Weilong Liao
2026-06-18 12:37:38 +08:00
committed by GitHub
parent 2c8f38c886
commit 264e7eaaa3
12 changed files with 411 additions and 29 deletions

View File

@@ -8,7 +8,7 @@ info:
JSON objects because their schemas are provided at runtime by template
endpoints.
Developer API keys currently support these scopes only: bot, provider,
persona, im, config, chat, plugin, mcp, skill. The config scope also
persona, im, config, chat, file, plugin, mcp, skill. The config scope also
grants bot and provider access.
servers:
- url: http://localhost:6185
@@ -18,6 +18,7 @@ security:
- ApiKeyAuth: []
tags:
- name: Open API
- name: Auth
- name: API Keys
- name: System Config
@@ -1551,6 +1552,37 @@ paths:
"200":
$ref: "#/components/responses/Ok"
/api/v1/file:
post:
tags: [Open API]
summary: Upload a file
operationId: uploadOpenApiFile
x-astrbot-scope: file
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: "#/components/schemas/FileUploadRequest"
responses:
"200":
$ref: "#/components/responses/Ok"
get:
tags: [Open API]
summary: Download an uploaded file by attachment ID
operationId: downloadOpenApiFile
x-astrbot-scope: file
parameters:
- $ref: "#/components/parameters/AttachmentIdQuery"
responses:
"200":
description: File content or an error envelope
content:
application/octet-stream:
schema:
type: string
format: binary
/api/v1/files/content:
get:
tags: [Files]
@@ -4823,6 +4855,12 @@ components:
required: true
schema:
type: string
AttachmentIdQuery:
name: attachment_id
in: query
required: true
schema:
type: string
BotId:
name: bot_id
in: path
@@ -5089,8 +5127,8 @@ components:
type: array
items:
type: string
enum: [bot, provider, persona, im, config, chat, plugin, mcp, skill]
example: [bot, provider, persona, im, config, chat, plugin, mcp, skill]
enum: [bot, provider, persona, im, config, chat, file, plugin, mcp, skill]
example: [bot, provider, persona, im, config, chat, file, plugin, mcp, skill]
expires_at:
type: string
format: date-time