增加文本中转功能

This commit is contained in:
2026-01-13 17:07:27 +08:00
parent d2352318f4
commit 9c10dfd496
8 changed files with 370 additions and 12 deletions

View File

@@ -640,6 +640,64 @@ const docTemplate = `{
}
}
}
},
"/api/upload/text": {
"post": {
"description": "中转一段长文本内容并创建一个提取批次",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Public"
],
"summary": "发送长文本",
"parameters": [
{
"description": "文本内容及配置",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/public.UploadTextRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/model.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/public.UploadResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/model.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/model.Response"
}
}
}
}
}
},
"definitions": {
@@ -762,6 +820,9 @@ const docTemplate = `{
"model.FileBatch": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"created_at": {
"type": "string"
},
@@ -797,6 +858,10 @@ const docTemplate = `{
"description": "active / expired / deleted",
"type": "string"
},
"type": {
"description": "file / text",
"type": "string"
},
"updated_at": {
"type": "string"
}
@@ -845,6 +910,9 @@ const docTemplate = `{
"public.PickupResponse": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"download_count": {
"type": "integer"
},
@@ -865,6 +933,9 @@ const docTemplate = `{
},
"remark": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
@@ -881,6 +952,34 @@ const docTemplate = `{
"type": "string"
}
}
},
"public.UploadTextRequest": {
"type": "object",
"required": [
"content"
],
"properties": {
"content": {
"type": "string",
"example": "这是一段长文本内容..."
},
"expire_days": {
"type": "integer",
"example": 7
},
"expire_type": {
"type": "string",
"example": "time"
},
"max_downloads": {
"type": "integer",
"example": 5
},
"remark": {
"type": "string",
"example": "文本备注"
}
}
}
},
"securityDefinitions": {

View File

@@ -633,6 +633,64 @@
}
}
}
},
"/api/upload/text": {
"post": {
"description": "中转一段长文本内容并创建一个提取批次",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Public"
],
"summary": "发送长文本",
"parameters": [
{
"description": "文本内容及配置",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/public.UploadTextRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/model.Response"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/public.UploadResponse"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/model.Response"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/model.Response"
}
}
}
}
}
},
"definitions": {
@@ -755,6 +813,9 @@
"model.FileBatch": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"created_at": {
"type": "string"
},
@@ -790,6 +851,10 @@
"description": "active / expired / deleted",
"type": "string"
},
"type": {
"description": "file / text",
"type": "string"
},
"updated_at": {
"type": "string"
}
@@ -838,6 +903,9 @@
"public.PickupResponse": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"download_count": {
"type": "integer"
},
@@ -858,6 +926,9 @@
},
"remark": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
@@ -874,6 +945,34 @@
"type": "string"
}
}
},
"public.UploadTextRequest": {
"type": "object",
"required": [
"content"
],
"properties": {
"content": {
"type": "string",
"example": "这是一段长文本内容..."
},
"expire_days": {
"type": "integer",
"example": 7
},
"expire_type": {
"type": "string",
"example": "time"
},
"max_downloads": {
"type": "integer",
"example": 5
},
"remark": {
"type": "string",
"example": "文本备注"
}
}
}
},
"securityDefinitions": {

View File

@@ -78,6 +78,8 @@ definitions:
type: object
model.FileBatch:
properties:
content:
type: string
created_at:
type: string
download_count:
@@ -102,6 +104,9 @@ definitions:
status:
description: active / expired / deleted
type: string
type:
description: file / text
type: string
updated_at:
type: string
type: object
@@ -134,6 +139,8 @@ definitions:
type: object
public.PickupResponse:
properties:
content:
type: string
download_count:
type: integer
expire_at:
@@ -148,6 +155,8 @@ definitions:
type: integer
remark:
type: string
type:
type: string
type: object
public.UploadResponse:
properties:
@@ -158,6 +167,26 @@ definitions:
pickup_code:
type: string
type: object
public.UploadTextRequest:
properties:
content:
example: 这是一段长文本内容...
type: string
expire_days:
example: 7
type: integer
expire_type:
example: time
type: string
max_downloads:
example: 5
type: integer
remark:
example: 文本备注
type: string
required:
- content
type: object
info:
contact:
email: support@swagger.io
@@ -545,6 +574,41 @@ paths:
summary: 上传文件
tags:
- Public
/api/upload/text:
post:
consumes:
- application/json
description: 中转一段长文本内容并创建一个提取批次
parameters:
- description: 文本内容及配置
in: body
name: request
required: true
schema:
$ref: '#/definitions/public.UploadTextRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/model.Response'
- properties:
data:
$ref: '#/definitions/public.UploadResponse'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/model.Response'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/model.Response'
summary: 发送长文本
tags:
- Public
securityDefinitions:
AdminAuth:
description: Type "Bearer <your-jwt-token>" to authenticate.