Files
2026-01-16 13:03:57 +08:00

348 lines
8.2 KiB
JSON
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.
{
"swagger": "2.0",
"info": {
"title": "CNB OPENAPI",
"contact": {
"name": "Open API Support",
"url": "https://docs.cnb.cool/",
"email": "cnb@tencent.com"
},
"version": "1.0"
},
"paths": {
"/{repo}/-/knowledge/base": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"KnowledgeBase"
],
"summary": "获取知识库信息",
"operationId": "GetKnowledgeBaseInfo",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.KnowledgeBaseInfoRes"
}
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"KnowledgeBase"
],
"summary": "删除知识库",
"operationId": "DeleteKnowledgeBase",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:rw"
}
},
"/{repo}/-/knowledge/base/query": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"KnowledgeBase"
],
"summary": "查询知识库使用文档https://docs.cnb.cool/zh/ai/knowledge-base.html",
"operationId": "QueryKnowledgeBase",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"description": "查询内容",
"name": "query",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.QueryKnowledgeBaseReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.QueryKnowledgeBaseRes"
}
}
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/knowledge/embedding/models": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"KnowledgeBase"
],
"summary": "获取当前支持的 Embedding 模型列表",
"operationId": "GetModels",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.EmbeddingModel"
}
}
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
}
},
"definitions": {
"dto.KnowledgeBaseInfoRes": {
"type": "object",
"properties": {
"embedding_model": {
"$ref": "#/definitions/dto.EmbeddingModels"
},
"exclude": {
"type": "string"
},
"id": {
"type": "string"
},
"include": {
"type": "string"
},
"issue_last_sync_time": {
"type": "string"
},
"issue_sync_enabled": {
"type": "boolean"
},
"last_commit_sha": {
"type": "string"
},
"metadata": {
"$ref": "#/definitions/dto.KnowledgeBaseMetadata"
},
"statistics": {
"$ref": "#/definitions/dto.DocumentStatistics"
}
}
},
"dto.QueryKnowledgeBaseReq": {
"type": "object",
"properties": {
"metadata_filtering_conditions": {
"description": "元数据过滤条件",
"allOf": [
{
"$ref": "#/definitions/dto.MetadataFilteringConditions"
}
]
},
"query": {
"description": "查询语句",
"type": "string"
},
"score_threshold": {
"description": "分数阈值",
"type": "number"
},
"top_k": {
"description": "返回结果的数量",
"type": "integer"
}
}
},
"dto.QueryKnowledgeBaseRes": {
"type": "object",
"properties": {
"chunk": {
"type": "string"
},
"metadata": {
"type": "object",
"additionalProperties": true
},
"score": {
"type": "number"
}
}
},
"dto.EmbeddingModel": {
"type": "object",
"properties": {
"dimension": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"dto.EmbeddingModels": {
"type": "object",
"properties": {
"dimension": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"dto.KnowledgeBaseMetadata": {
"type": "object",
"properties": {
"issue": {
"$ref": "#/definitions/dto.IssueConfig"
},
"processing": {
"$ref": "#/definitions/dto.ProcessingConfig"
},
"version": {
"type": "string"
}
}
},
"dto.DocumentStatistics": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"size": {
"type": "integer"
}
}
},
"dto.IssueConfig": {
"type": "object",
"properties": {
"labels": {
"description": "逗号分隔的标签字符串,如 \"bug,feature\"",
"type": "string"
},
"state": {
"description": "\"open\", \"closed\"",
"type": "string"
}
}
},
"dto.ProcessingConfig": {
"type": "object",
"properties": {
"chunk_overlap": {
"type": "integer"
},
"chunk_size": {
"type": "integer"
},
"text_separator": {
"type": "string"
}
}
}
}
}