---
title: "生成知识库描述"
method: POST
path: "/knowledge-bases/{id}/profile/generate"
tags: ["知识库"]
---

# 生成知识库描述

`POST /knowledge-bases/{id}/profile/generate`

## Request

- Base URL: `/api/v1` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/v1/knowledge-bases/{id}/profile/generate`
- Auth: one of:
  - API key in header `Authorization`
  - API key in header `X-API-Key`

基于文档画像聚合，立即重新生成知识库的 AI 描述（不覆盖手写描述）

## Path parameters

- `id` string, required

## Response `200`

生成的知识库画像

- object
  - `data` GithubComTencentWeKnoraInternalTypesKnowledgeBaseProfile
    - `aggregate_hash` string: AggregateHash identifies the aggregate the gist was generated from. A mismatch with the live aggregate means the text is stale.
    - `error` string: Error holds the last generation error when Status is failed.
    - `generated_at` string: GeneratedAt records when the text was produced.
    - `gist` string: Gist is a short statement of what the knowledge base covers.
    - `model_id` string: ModelID records which chat model produced the text.
    - `stats` GithubComTencentWeKnoraInternalTypesKnowledgeBaseProfileStats
      - `doc_types` GithubComTencentWeKnoraInternalTypesNamedCount[]: DocTypes counts documents per model-assigned document type.
        - `count` integer
        - `name` string
      - `document_count` integer: DocumentCount is the number of eligible documents at generation time.
      - `earliest_at` string: EarliestAt and LatestAt bound document creation times.
      - `file_types` GithubComTencentWeKnoraInternalTypesNamedCount[]: FileTypes counts documents per file extension.
        - `count` integer
        - `name` string
      - `folders` string[]: Folders lists the top-level folder names present.
      - `latest_at` string
      - `profiled_count` integer: ProfiledCount is how many of them carried a document profile.
      - `raw_topics` GithubComTencentWeKnoraInternalTypesNamedCount[]: RawTopics counts documents per normalized topic keyword before merging.
        - `count` integer
        - `name` string
      - `tags` GithubComTencentWeKnoraInternalTypesNamedCount[]: Tags counts documents per knowledge-base tag.
        - `count` integer
        - `name` string
    - `status` string: Status is one of the KnowledgeBaseProfileStatus* values.
    - `topics` string[]: Topics is the merged topic list (at most KnowledgeBaseProfileMaxTopics).
    - `typical_questions` string[]: TypicalQuestions lists questions this knowledge base can answer.
  - `success` boolean

## Other responses

- `400`: 知识库类型不支持或未配置模型
- `403`: 无权限
- `404`: 知识库不存在

## Changes

- **2026-10-14** `7909fe890afd`: 2 info
  - added the non-success response with the status `403`
  - added the non-success response with the status `404`
- **2026-10-14** `a1c41ab134cc`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/tencentblueking/apis/weknora-api/changes/knowledge-bases/:id/profile/generate/post.md)

---

[API](https://skmtc.dev/tencentblueking/apis/weknora-api.md) - [All operations](https://skmtc.dev/tencentblueking/apis/weknora-api/llms.txt) - [OpenAPI document](https://skmtc.dev/tencentblueking/apis/weknora-api/revisions/685d1f9fce30?raw)
