Files

1092 lines
29 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>X-Request API Framework - 接口文档</title>
<!-- 本地Swagger UI资源 -->
<link rel="stylesheet" href="/vendor/swagger-ui.css">
<script src="/vendor/swagger-ui-bundle.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background: #f8fafc;
}
.nav {
background: white;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
height: 64px;
display: flex;
align-items: center;
padding: 0 24px;
position: sticky;
top: 0;
z-index: 100;
}
.nav-brand {
display: flex;
align-items: center;
font-size: 20px;
font-weight: 600;
color: #1f2937;
}
.nav-brand i {
color: #3b82f6;
margin-right: 8px;
}
.nav-links {
display: flex;
margin-left: 24px;
gap: 8px;
}
.nav-link {
padding: 8px 12px;
border-radius: 6px;
text-decoration: none;
font-size: 14px;
color: #6b7280;
transition: all 0.2s;
}
.nav-link:hover {
background: rgba(59, 130, 246, 0.1);
color: #3b82f6;
}
.nav-link.active {
background: rgba(59, 130, 246, 0.1);
color: #3b82f6;
border-bottom: 2px solid #3b82f6;
}
.nav-right {
margin-left: auto;
display: flex;
align-items: center;
gap: 16px;
}
.api-version {
font-size: 14px;
color: #6b7280;
}
.api-version span {
font-weight: 500;
color: #1f2937;
}
.main {
padding: 16px 24px;
}
.doc-container {
background: white;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
min-height: calc(100vh - 120px);
}
/* Swagger UI 样式覆盖 */
.swagger-ui .topbar {
display: none;
}
.swagger-ui .info {
margin: 20px 0;
}
.swagger-ui .scheme-container {
background: #f8fafc;
padding: 15px;
box-shadow: none;
}
/* Font Awesome 图标 (内联) */
.fa {
display: inline-block;
font-style: normal;
}
.fa-file-text-o:before { content: "📄"; }
.fa-file-text:before { content: "📝"; }
.fa-book:before { content: "📖"; }
.fa-home:before { content: "🏠"; }
</style>
</head>
<body>
<nav class="nav">
<div class="nav-brand">
<i class="fa fa-file-text-o"></i>
X-Request 管理系统
</div>
<div class="nav-links">
<a href="/log.html" class="nav-link">
<i class="fa fa-file-text"></i> 日志管理
</a>
<a href="/doc.html" class="nav-link active">
<i class="fa fa-book"></i> 接口文档
</a>
<a href="/" class="nav-link">
<i class="fa fa-home"></i> 首页
</a>
</div>
<div class="nav-right">
<div class="api-version">
API版本: <span>1.0.0</span>
</div>
</div>
</nav>
<main class="main">
<div class="doc-container">
<div id="swagger-ui"></div>
</div>
</main>
<script>
// 内嵌的OpenAPI规范
const spec = {
"openapi": "3.1.0",
"info": {
"title": "X-Request API Framework",
"description": "高性能、高并发的请求框架",
"version": "1.0.0"
},
"paths": {
"/": {
"get": {
"summary": "Root",
"description": "根路径 - 重定向到前端监控界面",
"operationId": "root__get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/dashboard": {
"get": {
"summary": "Dashboard",
"description": "前端监控界面",
"operationId": "dashboard_dashboard_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/health": {
"get": {
"summary": "Health Check",
"description": "健康检查",
"operationId": "health_check_health_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/info": {
"get": {
"summary": "App Info",
"description": "应用信息",
"operationId": "app_info_info_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/routes": {
"get": {
"summary": "Get Routes Info",
"description": "获取所有路由信息",
"operationId": "get_routes_info_routes_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/monitoring/logs/batch/delete": {
"post": {
"tags": [
"Monitoring"
],
"summary": "批量删除日志文件",
"description": "批量删除日志文件\n\nArgs:\n request: 批量删除请求,包含日志文件路径列表",
"operationId": "batch_delete_logs_monitoring_logs_batch_delete_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchDeleteRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/monitoring/logs/download": {
"post": {
"tags": [
"Monitoring"
],
"summary": "批量下载日志文件",
"description": "批量下载日志文件\n\nArgs:\n request: 批量下载请求,包含日志文件路径列表",
"operationId": "batch_download_logs_monitoring_logs_download_post",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchDownloadRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/monitoring/logs/{log_name}": {
"delete": {
"tags": [
"Monitoring"
],
"summary": "删除单个日志文件",
"description": "删除单个日志文件\n\nArgs:\n log_name: 日志文件名支持带日期路径如YYYY-MM-DD/filename.log",
"operationId": "delete_log_monitoring_logs__log_name__delete",
"parameters": [
{
"name": "log_name",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Log Name"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
},
"get": {
"tags": [
"Monitoring"
],
"summary": "获取日志内容",
"description": "获取日志文件内容\n\nArgs:\n log_name: 日志文件名\n lines: 返回的行数默认100行",
"operationId": "get_log_content_monitoring_logs__log_name__get",
"parameters": [
{
"name": "log_name",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Log Name"
}
},
{
"name": "lines",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"default": 100,
"title": "Lines"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/monitoring/logs/{date}/{log_name}": {
"delete": {
"tags": [
"Monitoring"
],
"summary": "删除指定日期的单个日志文件",
"description": "删除指定日期的单个日志文件\n\nArgs:\n date: 日期格式为YYYY-MM-DD\n log_name: 日志文件名",
"operationId": "delete_log_by_date_monitoring_logs__date___log_name__delete",
"parameters": [
{
"name": "date",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Date"
}
},
{
"name": "log_name",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Log Name"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
},
"get": {
"tags": [
"Monitoring"
],
"summary": "获取指定日期的日志内容",
"description": "获取指定日期的日志内容\n\nArgs:\n date: 日期格式为YYYY-MM-DD\n log_name: 日志文件名\n entries: 返回的日志条目数量默认10个\n mode: 显示模式latest表示最新的N个条目显示在顶部oldest表示最早的N个条目显示在顶部默认latest",
"operationId": "get_log_content_by_date_monitoring_logs__date___log_name__get",
"parameters": [
{
"name": "date",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Date"
}
},
{
"name": "log_name",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Log Name"
}
},
{
"name": "entries",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"default": 10,
"title": "Entries"
}
},
{
"name": "mode",
"in": "query",
"required": false,
"schema": {
"type": "string",
"default": "latest",
"title": "Mode"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/monitoring/logs/{log_name}/download": {
"get": {
"tags": [
"Monitoring"
],
"summary": "下载日志文件",
"description": "下载日志文件\n\nArgs:\n log_name: 日志文件名支持带日期路径如YYYY-MM-DD/filename.log",
"operationId": "download_log_monitoring_logs__log_name__download_get",
"parameters": [
{
"name": "log_name",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Log Name"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/monitoring/logs/{date}/{log_name}/download": {
"get": {
"tags": [
"Monitoring"
],
"summary": "下载指定日期的日志文件",
"description": "下载指定日期的日志文件\n\nArgs:\n date: 日期格式为YYYY-MM-DD\n log_name: 日志文件名",
"operationId": "download_log_by_date_monitoring_logs__date___log_name__download_get",
"parameters": [
{
"name": "date",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Date"
}
},
{
"name": "log_name",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "Log Name"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/monitoring/logs": {
"get": {
"tags": [
"Monitoring"
],
"summary": "获取日志列表",
"description": "获取日志列表,支持按时间分类\n\nArgs:\n date: 日期格式为YYYY-MM-DD如不提供则返回所有日期文件夹",
"operationId": "get_logs_list_monitoring_logs_get",
"parameters": [
{
"name": "date",
"in": "query",
"required": false,
"schema": {
"type": "string",
"title": "Date"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/monitoring/status": {
"get": {
"tags": [
"Monitoring"
],
"summary": "获取服务器状态",
"description": "获取服务器基本状态信息",
"operationId": "get_server_status_monitoring_status_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/api/datasets/{file_id}": {
"delete": {
"tags": [
"Datasets"
],
"summary": "delete_dataset",
"description": "删除数据集\n\nArgs:\n file_id: 文件ID\n\nReturns:\n StandardResponse: 包含删除结果的标准响应",
"operationId": "delete_dataset_api_datasets__file_id__delete",
"parameters": [
{
"name": "file_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "File Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StandardResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
},
"get": {
"tags": [
"Datasets"
],
"summary": "get_dataset",
"description": "获取特定数据集的详细信息\n\nArgs:\n file_id: 文件ID\n\nReturns:\n StandardResponse: 包含数据集详情的标准响应",
"operationId": "get_dataset_api_datasets__file_id__get",
"parameters": [
{
"name": "file_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "File Id"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StandardResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/datasets/{file_id}/content": {
"get": {
"tags": [
"Datasets"
],
"summary": "get_dataset_content",
"description": "获取数据集文件内容前N条记录\n\nArgs:\n file_id: 文件ID\n limit: 返回的记录数量默认5条\n\nReturns:\n StandardResponse: 包含数据集内容的标准响应",
"operationId": "get_dataset_content_api_datasets__file_id__content_get",
"parameters": [
{
"name": "file_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"title": "File Id"
}
},
{
"name": "limit",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"default": 5,
"title": "Limit"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StandardResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/datasets/list-files": {
"get": {
"tags": [
"Datasets"
],
"summary": "list_data_files",
"description": "查询data目录下的文件列表\n\nReturns:\n StandardResponse: 包含文件列表的标准响应",
"operationId": "list_data_files_api_datasets_list_files_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StandardResponse"
}
}
}
}
}
}
},
"/api/datasets": {
"get": {
"tags": [
"Datasets"
],
"summary": "list_datasets",
"description": "获取所有数据集列表\n\nArgs:\n list_all: 是否列出data目录下的所有文件物理文件默认False只列出API上传的文件\n\nReturns:\n StandardResponse: 包含数据集列表的标准响应",
"operationId": "list_datasets_api_datasets_get",
"parameters": [
{
"name": "list_all",
"in": "query",
"required": false,
"schema": {
"type": "boolean",
"default": false,
"title": "List All"
}
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StandardResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/datasets/upload": {
"post": {
"tags": [
"Datasets"
],
"summary": "upload_dataset",
"description": "上传数据集文件\n\nArgs:\n file: 上传的文件(支持 .json, .jsonl 格式)\n description: 文件描述(可选)\n\nReturns:\n StandardResponse: 包含上传结果的标准响应",
"operationId": "upload_dataset_api_datasets_upload_post",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/Body_upload_dataset_api_datasets_upload_post"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StandardResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"BatchDeleteRequest": {
"properties": {
"files": {
"items": {
"type": "string"
},
"type": "array",
"title": "Files"
}
},
"type": "object",
"required": [
"files"
],
"title": "BatchDeleteRequest",
"description": "批量删除请求模型"
},
"BatchDownloadRequest": {
"properties": {
"files": {
"items": {
"type": "string"
},
"type": "array",
"title": "Files"
}
},
"type": "object",
"required": [
"files"
],
"title": "BatchDownloadRequest",
"description": "批量下载请求模型"
},
"Body_upload_dataset_api_datasets_upload_post": {
"properties": {
"file": {
"type": "string",
"format": "binary",
"title": "File"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Description"
}
},
"type": "object",
"required": [
"file"
],
"title": "Body_upload_dataset_api_datasets_upload_post"
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
},
"StandardResponse": {
"properties": {
"status": {
"type": "integer",
"title": "Status"
},
"response": {
"title": "Response"
},
"time": {
"type": "string",
"title": "Time"
}
},
"type": "object",
"required": [
"status",
"response",
"time"
],
"title": "StandardResponse",
"description": "标准响应格式"
},
"ValidationError": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
}
}
}
};
window.onload = function() {
SwaggerUIBundle({
spec: spec,
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset
],
layout: "BaseLayout",
defaultModelsExpandDepth: 1,
defaultModelExpandDepth: 1,
docExpansion: "list",
filter: true,
showExtensions: true,
showCommonExtensions: true
});
};
</script>
</body>
</html>