mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-30 20:35:22 +08:00
* doc: add service api refs (#67) * doc: add service api refs * fix: page title * docs: add Service API overview and images, mark as Beta * doc: update for plugin system on windows * docs: perf * doc: add pipeline plugin comments
1944 lines
48 KiB
JSON
1944 lines
48 KiB
JSON
{
|
||
"openapi": "3.0.3",
|
||
"info": {
|
||
"title": "LangBot API 与 API 密钥认证",
|
||
"description": "LangBot 外部服务 API 文档。这些接口支持 API 密钥认证,\n供外部系统以编程方式访问 LangBot 资源。\n\n**认证方式:**\n- 用户令牌(通过 `Authorization: Bearer <token>`)\n- API 密钥(通过 `X-API-Key: <key>` 或 `Authorization: Bearer <key>`)\n\n本文档中的所有接口都同时支持这两种认证方式。\n",
|
||
"version": "4.4.1",
|
||
"contact": {
|
||
"name": "LangBot",
|
||
"url": "https://langbot.app"
|
||
},
|
||
"license": {
|
||
"name": "AGPL-3.0",
|
||
"url": "https://github.com/langbot-app/LangBot/blob/master/LICENSE"
|
||
}
|
||
},
|
||
"servers": [
|
||
{
|
||
"url": "http://localhost:5300",
|
||
"description": "本地开发服务器"
|
||
}
|
||
],
|
||
"tags": [
|
||
{
|
||
"name": "模型 - 大语言模型",
|
||
"description": "大语言模型管理操作"
|
||
},
|
||
{
|
||
"name": "模型 - 向量模型",
|
||
"description": "向量模型管理操作"
|
||
},
|
||
{
|
||
"name": "机器人",
|
||
"description": "机器人实例管理操作"
|
||
},
|
||
{
|
||
"name": "流水线",
|
||
"description": "流水线配置管理操作"
|
||
}
|
||
],
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"paths": {
|
||
"/api/v1/provider/models/llm": {
|
||
"get": {
|
||
"tags": [
|
||
"模型 - 大语言模型"
|
||
],
|
||
"summary": "列出所有大语言模型",
|
||
"description": "获取所有已配置的大语言模型列表",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功响应",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"models": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/LLMModel"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"tags": [
|
||
"模型 - 大语言模型"
|
||
],
|
||
"summary": "创建新的大语言模型",
|
||
"description": "创建并配置一个新的大语言模型",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/LLMModelCreate"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "模型创建成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"uuid": {
|
||
"type": "string",
|
||
"format": "uuid",
|
||
"example": "550e8400-e29b-41d4-a716-446655440000"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalServerError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/provider/models/llm/{model_uuid}": {
|
||
"get": {
|
||
"tags": [
|
||
"模型 - 大语言模型"
|
||
],
|
||
"summary": "获取指定的大语言模型",
|
||
"description": "通过 UUID 获取指定大语言模型的详细信息",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/ModelUUID"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功响应",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"model": {
|
||
"$ref": "#/components/schemas/LLMModel"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"tags": [
|
||
"模型 - 大语言模型"
|
||
],
|
||
"summary": "更新大语言模型",
|
||
"description": "更新现有大语言模型的配置",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/ModelUUID"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/LLMModelUpdate"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "模型更新成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SuccessResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"tags": [
|
||
"模型 - 大语言模型"
|
||
],
|
||
"summary": "删除大语言模型",
|
||
"description": "从系统中删除一个大语言模型",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/ModelUUID"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "模型删除成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SuccessResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/provider/models/llm/{model_uuid}/test": {
|
||
"post": {
|
||
"tags": [
|
||
"模型 - 大语言模型"
|
||
],
|
||
"summary": "测试大语言模型",
|
||
"description": "测试大语言模型的连接性和功能",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/ModelUUID"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"description": "要测试的模型配置"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "模型测试成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SuccessResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
},
|
||
"500": {
|
||
"$ref": "#/components/responses/InternalServerError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/provider/models/embedding": {
|
||
"get": {
|
||
"tags": [
|
||
"模型 - 向量模型"
|
||
],
|
||
"summary": "列出所有向量模型",
|
||
"description": "获取所有已配置的向量模型列表",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功响应",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"models": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/EmbeddingModel"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"tags": [
|
||
"模型 - 向量模型"
|
||
],
|
||
"summary": "创建新的向量模型",
|
||
"description": "创建并配置一个新的向量模型",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/EmbeddingModelCreate"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "模型创建成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"uuid": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/provider/models/embedding/{model_uuid}": {
|
||
"get": {
|
||
"tags": [
|
||
"模型 - 向量模型"
|
||
],
|
||
"summary": "获取指定的向量模型",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/ModelUUID"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功响应",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"model": {
|
||
"$ref": "#/components/schemas/EmbeddingModel"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"tags": [
|
||
"模型 - 向量模型"
|
||
],
|
||
"summary": "更新向量模型",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/ModelUUID"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/EmbeddingModelUpdate"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "模型更新成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SuccessResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"tags": [
|
||
"模型 - 向量模型"
|
||
],
|
||
"summary": "删除向量模型",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/ModelUUID"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "模型删除成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SuccessResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/provider/models/embedding/{model_uuid}/test": {
|
||
"post": {
|
||
"tags": [
|
||
"模型 - 向量模型"
|
||
],
|
||
"summary": "测试向量模型",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"$ref": "#/components/parameters/ModelUUID"
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "模型测试成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SuccessResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/platform/bots": {
|
||
"get": {
|
||
"tags": [
|
||
"机器人"
|
||
],
|
||
"summary": "列出所有机器人",
|
||
"description": "获取所有已配置的机器人实例列表",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功响应",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"bots": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/Bot"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"tags": [
|
||
"机器人"
|
||
],
|
||
"summary": "创建新的机器人",
|
||
"description": "创建并配置一个新的机器人实例",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/BotCreate"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "机器人创建成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"uuid": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/platform/bots/{bot_uuid}": {
|
||
"get": {
|
||
"tags": [
|
||
"机器人"
|
||
],
|
||
"summary": "获取指定的机器人",
|
||
"description": "获取指定机器人实例的详细信息",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"name": "bot_uuid",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "机器人 UUID"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功响应",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"bot": {
|
||
"$ref": "#/components/schemas/Bot"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"tags": [
|
||
"机器人"
|
||
],
|
||
"summary": "更新机器人",
|
||
"description": "更新现有机器人实例的配置",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"name": "bot_uuid",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/BotUpdate"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "机器人更新成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SuccessResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"tags": [
|
||
"机器人"
|
||
],
|
||
"summary": "删除机器人",
|
||
"description": "从系统中删除一个机器人实例",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"name": "bot_uuid",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "机器人删除成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SuccessResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/platform/bots/{bot_uuid}/logs": {
|
||
"post": {
|
||
"tags": [
|
||
"机器人"
|
||
],
|
||
"summary": "获取机器人事件日志",
|
||
"description": "获取指定机器人的事件日志",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"name": "bot_uuid",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"from_index": {
|
||
"type": "integer",
|
||
"default": -1,
|
||
"description": "日志起始索引(-1 表示最新)"
|
||
},
|
||
"max_count": {
|
||
"type": "integer",
|
||
"default": 10,
|
||
"description": "要获取的最大日志数量"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功响应",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"logs": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object"
|
||
}
|
||
},
|
||
"total_count": {
|
||
"type": "integer"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/pipelines": {
|
||
"get": {
|
||
"tags": [
|
||
"流水线"
|
||
],
|
||
"summary": "列出所有流水线",
|
||
"description": "获取所有已配置的流水线列表",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"name": "sort_by",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "string",
|
||
"default": "created_at"
|
||
},
|
||
"description": "排序字段"
|
||
},
|
||
{
|
||
"name": "sort_order",
|
||
"in": "query",
|
||
"schema": {
|
||
"type": "string",
|
||
"enum": [
|
||
"ASC",
|
||
"DESC"
|
||
],
|
||
"default": "DESC"
|
||
},
|
||
"description": "排序顺序"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功响应",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"pipelines": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/components/schemas/Pipeline"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
}
|
||
}
|
||
},
|
||
"post": {
|
||
"tags": [
|
||
"流水线"
|
||
],
|
||
"summary": "创建新的流水线",
|
||
"description": "创建并配置一个新的流水线",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/PipelineCreate"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "流水线创建成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"uuid": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/pipelines/_/metadata": {
|
||
"get": {
|
||
"tags": [
|
||
"流水线"
|
||
],
|
||
"summary": "获取流水线元数据",
|
||
"description": "获取流水线的元数据和配置选项",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功响应",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"configs": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/pipelines/{pipeline_uuid}": {
|
||
"get": {
|
||
"tags": [
|
||
"流水线"
|
||
],
|
||
"summary": "获取指定的流水线",
|
||
"description": "获取指定流水线的详细信息",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"name": "pipeline_uuid",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功响应",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"properties": {
|
||
"pipeline": {
|
||
"$ref": "#/components/schemas/Pipeline"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"tags": [
|
||
"流水线"
|
||
],
|
||
"summary": "更新流水线",
|
||
"description": "更新现有流水线的配置",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"name": "pipeline_uuid",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/PipelineUpdate"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "流水线更新成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SuccessResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
},
|
||
"delete": {
|
||
"tags": [
|
||
"流水线"
|
||
],
|
||
"summary": "删除流水线",
|
||
"description": "从系统中删除一个流水线",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"name": "pipeline_uuid",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "流水线删除成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SuccessResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/v1/pipelines/{pipeline_uuid}/extensions": {
|
||
"get": {
|
||
"tags": [
|
||
"流水线"
|
||
],
|
||
"summary": "获取流水线扩展",
|
||
"description": "获取流水线配置的扩展和插件",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"name": "pipeline_uuid",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "成功响应",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
},
|
||
"put": {
|
||
"tags": [
|
||
"流水线"
|
||
],
|
||
"summary": "更新流水线扩展",
|
||
"description": "更新流水线的扩展配置",
|
||
"security": [
|
||
{
|
||
"ApiKeyAuth": []
|
||
},
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"parameters": [
|
||
{
|
||
"name": "pipeline_uuid",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
}
|
||
}
|
||
],
|
||
"requestBody": {
|
||
"required": true,
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"200": {
|
||
"description": "扩展更新成功",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/SuccessResponse"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"401": {
|
||
"$ref": "#/components/responses/UnauthorizedError"
|
||
},
|
||
"404": {
|
||
"$ref": "#/components/responses/NotFoundError"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"components": {
|
||
"securitySchemes": {
|
||
"ApiKeyAuth": {
|
||
"type": "apiKey",
|
||
"in": "header",
|
||
"name": "X-API-Key",
|
||
"description": "使用 X-API-Key 请求头进行 API 密钥认证。\n示例:`X-API-Key: lbk_your_api_key_here`\n"
|
||
},
|
||
"BearerAuth": {
|
||
"type": "http",
|
||
"scheme": "bearer",
|
||
"description": "Bearer 令牌认证。可以是用户 JWT 令牌或 API 密钥。\n示例:`Authorization: Bearer <token_or_key>`\n"
|
||
}
|
||
},
|
||
"parameters": {
|
||
"ModelUUID": {
|
||
"name": "model_uuid",
|
||
"in": "path",
|
||
"required": true,
|
||
"schema": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"description": "模型 UUID"
|
||
}
|
||
},
|
||
"schemas": {
|
||
"LLMModel": {
|
||
"type": "object",
|
||
"properties": {
|
||
"uuid": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"name": {
|
||
"type": "string",
|
||
"example": "GPT-4"
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"example": "OpenAI GPT-4 model"
|
||
},
|
||
"requester": {
|
||
"type": "string",
|
||
"example": "openai-chat-completions"
|
||
},
|
||
"requester_config": {
|
||
"type": "object",
|
||
"properties": {
|
||
"model": {
|
||
"type": "string",
|
||
"example": "gpt-4"
|
||
},
|
||
"args": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"api_keys": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"keys": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"abilities": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"example": [
|
||
"chat",
|
||
"vision"
|
||
]
|
||
},
|
||
"extra_args": {
|
||
"type": "object"
|
||
},
|
||
"created_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"updated_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
}
|
||
}
|
||
},
|
||
"LLMModelCreate": {
|
||
"type": "object",
|
||
"required": [
|
||
"name",
|
||
"requester",
|
||
"requester_config",
|
||
"api_keys"
|
||
],
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"requester": {
|
||
"type": "string"
|
||
},
|
||
"requester_config": {
|
||
"type": "object"
|
||
},
|
||
"api_keys": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object"
|
||
}
|
||
},
|
||
"abilities": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"extra_args": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"LLMModelUpdate": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"requester_config": {
|
||
"type": "object"
|
||
},
|
||
"api_keys": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object"
|
||
}
|
||
},
|
||
"abilities": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
},
|
||
"extra_args": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"EmbeddingModel": {
|
||
"type": "object",
|
||
"properties": {
|
||
"uuid": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"requester": {
|
||
"type": "string"
|
||
},
|
||
"requester_config": {
|
||
"type": "object"
|
||
},
|
||
"api_keys": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object"
|
||
}
|
||
},
|
||
"extra_args": {
|
||
"type": "object"
|
||
},
|
||
"created_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"updated_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
}
|
||
}
|
||
},
|
||
"EmbeddingModelCreate": {
|
||
"type": "object",
|
||
"required": [
|
||
"name",
|
||
"requester",
|
||
"requester_config",
|
||
"api_keys"
|
||
],
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"requester": {
|
||
"type": "string"
|
||
},
|
||
"requester_config": {
|
||
"type": "object"
|
||
},
|
||
"api_keys": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object"
|
||
}
|
||
},
|
||
"extra_args": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"EmbeddingModelUpdate": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"description": {
|
||
"type": "string"
|
||
},
|
||
"requester_config": {
|
||
"type": "object"
|
||
},
|
||
"api_keys": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object"
|
||
}
|
||
},
|
||
"extra_args": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"Bot": {
|
||
"type": "object",
|
||
"properties": {
|
||
"uuid": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"adapter": {
|
||
"type": "string",
|
||
"example": "telegram"
|
||
},
|
||
"config": {
|
||
"type": "object"
|
||
},
|
||
"created_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"updated_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
}
|
||
}
|
||
},
|
||
"BotCreate": {
|
||
"type": "object",
|
||
"required": [
|
||
"name",
|
||
"adapter",
|
||
"config"
|
||
],
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"adapter": {
|
||
"type": "string"
|
||
},
|
||
"config": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"BotUpdate": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"config": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"Pipeline": {
|
||
"type": "object",
|
||
"properties": {
|
||
"uuid": {
|
||
"type": "string",
|
||
"format": "uuid"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"config": {
|
||
"type": "object"
|
||
},
|
||
"is_default": {
|
||
"type": "boolean"
|
||
},
|
||
"created_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
},
|
||
"updated_at": {
|
||
"type": "string",
|
||
"format": "date-time"
|
||
}
|
||
}
|
||
},
|
||
"PipelineCreate": {
|
||
"type": "object",
|
||
"required": [
|
||
"name",
|
||
"config"
|
||
],
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"config": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"PipelineUpdate": {
|
||
"type": "object",
|
||
"properties": {
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"config": {
|
||
"type": "object"
|
||
}
|
||
}
|
||
},
|
||
"SuccessResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": 0
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "ok"
|
||
},
|
||
"data": {
|
||
"type": "object",
|
||
"nullable": true
|
||
}
|
||
}
|
||
},
|
||
"ErrorResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "integer",
|
||
"example": -1
|
||
},
|
||
"msg": {
|
||
"type": "string",
|
||
"example": "错误消息"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"responses": {
|
||
"UnauthorizedError": {
|
||
"description": "需要认证或凭据无效",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/ErrorResponse"
|
||
},
|
||
"examples": {
|
||
"no_auth": {
|
||
"value": {
|
||
"code": -1,
|
||
"msg": "未提供有效认证(需要用户令牌或 API 密钥)"
|
||
}
|
||
},
|
||
"invalid_key": {
|
||
"value": {
|
||
"code": -1,
|
||
"msg": "无效的 API 密钥"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"NotFoundError": {
|
||
"description": "资源未找到",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/ErrorResponse"
|
||
},
|
||
"example": {
|
||
"code": -1,
|
||
"msg": "资源未找到"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"InternalServerError": {
|
||
"description": "内部服务器错误",
|
||
"content": {
|
||
"application/json": {
|
||
"schema": {
|
||
"$ref": "#/components/schemas/ErrorResponse"
|
||
},
|
||
"example": {
|
||
"code": -2,
|
||
"msg": "内部服务器错误"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |