创建知识库

curl -X POST 'https://HOST:PORT/api/v1/third_interface/knowledge/create'

鉴权

出于安全考虑,必须将 TOKEN 存储于服务端并通过后端接口调用,避免在前端代码中直接暴露,以防止凭证泄露造成损失

请在 HTTP 请求的 Authorization 请求头中包含您的 TOKEN,格式如下:

Authorization: Bearer {YOUR_TOKEN}

TOKEN获取可通过 个人令牌 和 OAuth 应用获取,具体见 个人令牌授权OAuth 授权码授权

应用秘钥private_key 的获取具体见 生成应用密钥

Request Body

  • name (string): 知识库名称
  • description (string): 知识库描述
  • document_type (str): 知识库类型 1文本类型 2表格类型 3图片类型 [默认: 1]
  • never_expired (int): 知识库过期 1永不过期 0设置过期时间 [默认: 1]
  • expired_time (datetime): 知识库过期时间 [默认: null]
  • search_type (str): 检索类型 0语义检索 1全文检索 2混合检索 [默认: 2]
  • model (string): 使用的向量模型类型 [默认: embedding-host]
  • refer_limit (int): 引用上限 [默认: 9000]
  • minimum_correlation: (float) 相关度0-1 [默认: 0.6]
  • top_k (int): 召回数量 [默认: 5]

Response

  • status_code (int): 状态码,200表示成功
  • status_message (string): 状态信息
  • data (dict): 返回的数据
    • model (str): 使用的向量模型类型

    • file_count (int): 知识库文件数量

    • id (int): 知识库ID

    • team_id: (int): 团队ID

    • default: (int): 是否是默认知识库 0否 1是

    • user_id: (int): 用户ID

    • refer_limit: (int): 片段引用上限

    • delete: (str): 是否删除 0否 1是

    • document_type (int): 知识库类型 1文本类型 2表格类型 3图片类型

    • search_type (str): 检索类型

    • never_expired (int)): 知识库过期 1永不过期 0设置过期时间

    • name (str)): 知识库名称

    • minimum_correlation (float): 相关度0-1

    • expired_time (datetime): 知识库过期时间

    • description (str): 知识库描述

    • top_k (int): 召回数量

    • create_time (datetime): 创建时间

    • total_file_size (int): 总文件大小

    • update_time (datetime): 更新时间

响应示例

{
  "status_code": 200,
  "status_message": "SUCCESS",
  "data": {
    "model": "embedding-host",
    "file_count": 0,
    "id": 778,
    "collection_name": "col_1755658777_05335993",
    "team_id": null,
    "index_name": "col_1755658777_76cf68ae",
    "default": 0,
    "user_id": 1,
    "refer_limit": 9000,
    "delete": 0,
    "document_type": 1,
    "search_type": "2",
    "never_expired": 1,
    "name": "知识库名称lhy0820",
    "minimum_correlation": 0.9,
    "expired_time": null,
    "description": "知识库描述",
    "top_k": 3,
    "create_time": "2025-08-20T10:59:38",
    "total_file_size": 0,
    "update_time": "2025-08-20T10:59:38"
  }
}