---
title: "更新知识库"
method: PUT
path: "/knowledge-bases/{id}"
tags: ["知识库"]
---

# 更新知识库

`PUT /knowledge-bases/{id}`

更新知识库的名称、描述和配置

## Path parameters

- `id` string, required

## Request body

- InternalHandlerUpdateKnowledgeBaseRequest
  - `config` GithubComTencentWeKnoraInternalTypesKnowledgeBaseConfig
    - `auto_tag_config` GithubComTencentWeKnoraInternalTypesAutoTagConfig
      - `enabled` boolean
      - `max_tags` integer
      - `model_id` string
      - `skip_if_tagged` boolean — SkipIfTagged leaves documents that already carry tags untouched, so a deliberate manual classification is not diluted by model guesses. It is a pointer because the default is true: rows written before this field existed decode to nil and must not silently flip to "always append".
    - `chunking_config` GithubComTencentWeKnoraInternalTypesChunkingConfig
      - `child_chunk_size` integer — ChildChunkSize is the size of child chunks used for embedding (default: 384). Only used when EnableParentChild is true.
      - `chunk_overlap` integer — Chunk overlap
      - `chunk_size` integer — Chunk size
      - `enable_parent_child` boolean — EnableParentChild enables two-level parent-child chunking strategy. When enabled, large parent chunks provide context while small child chunks are used for vector matching. Retrieval matches on child but returns parent content.
      - `languages` string[] — Languages hints the heuristic patterns. Empty = auto-detect from content. Examples: ["de"], ["en", "zh"].
      - `parent_chunk_size` integer — ParentChunkSize is the size of parent chunks (default: 4096). Only used when EnableParentChild is true.
      - `parser_engine_rules` GithubComTencentWeKnoraInternalTypesParserEngineRule[] — ParserEngineRules configures which parser engine to use for each file type. When empty, the builtin engine is used for all types.
        - `engine` string
        - `file_types` string[]
        - `xlsx_first_row_as_header` boolean — XLSXFirstRowAsHeader restores row-1 column context for flat XLSX tables. nil preserves the parser default; an explicit false disables the mode.
      - `separators` string[] — Separators
      - `strategy` string — Strategy selects the adaptive chunking tier. Empty / "legacy" preserves the historical recursive splitter; "auto" lets a profiler pick between heading-aware, heuristic and recursive tiers; "heading" / "heuristic" / "recursive" pin the tier explicitly.
      - `table_metadata_instructions` string — TableMetadataInstructions contains optional business guidance used when generating searchable summaries for CSV/Excel tables. The system-owned output contract remains fixed; these instructions only add domain context.
      - `token_limit` integer — TokenLimit caps chunk size in approximate tokens. 0 = use ChunkSize as a character count.
    - `faq_config` GithubComTencentWeKnoraInternalTypesFAQConfig
      - `index_mode` 'question_only' | 'question_answer'
      - `question_index_mode` 'combined' | 'separate'
    - `image_processing_config` GithubComTencentWeKnoraInternalTypesImageProcessingConfig
      - `model_id` string — Model ID
    - `indexing_strategy` GithubComTencentWeKnoraInternalTypesIndexingStrategy
      - `graph_enabled` boolean — GraphEnabled enables knowledge graph entity/relation extraction
      - `keyword_enabled` boolean — KeywordEnabled enables keyword-based (BM25) search
      - `vector_enabled` boolean — VectorEnabled enables semantic vector embedding and search
      - `wiki_enabled` boolean — WikiEnabled enables automatic wiki page generation from documents
    - `wiki_config` GithubComTencentWeKnoraInternalTypesWikiConfig
      - `content_instructions` string — ContentInstructions controls tone, structure and emphasis for generated summary/entity/index prose. Citation and merge rules remain system-owned.
      - `extraction_granularity` 'focused' | 'standard' | 'exhaustive'
      - `extraction_instructions` string — ExtractionInstructions tells candidate extraction which domain concepts to emphasize without replacing the stable JSON/citation protocol.
      - `ingest_batch_size` integer — IngestBatchSize controls how many pending ops a single batch claims and processes before scheduling a follow-up. 0 falls back to the hard-coded default (5). Larger batches amortize per-batch setup and let more docs share the batch-internal Map/Reduce fan-out; smaller batches spread a KB's backlog across more concurrent batches (finer scheduling grain).
      - `ingest_map_parallel` integer — IngestMapParallel sets the errgroup limit for the Map phase (per-document extraction + summary + chunk citation) WITHIN one batch. 0 falls back to 10. Bound by the LLM provider's concurrency limit and the worker's outbound HTTP pool. Remember it multiplies with the number of concurrent batches (IngestMaxInflight).
      - `ingest_max_inflight` integer — IngestMaxInflight caps how many ingest batches for THIS KB may run concurrently in the shared wiki worker pool (standard/Redis mode only). 0 falls back to the hard-coded default (4). Since Phase 3 removed the exclusive per-KB lock, one KB's backlog could otherwise monopolize the whole pool during a bulk import and starve other KBs; this knob trades a single KB's peak throughput for cross-KB fairness. Set it >= the wiki pool size to effectively disable the cap.
      - `ingest_reduce_parallel` integer — IngestReduceParallel sets the errgroup limit for the Reduce phase (per-slug page write) WITHIN one batch. 0 falls back to 10. Bound by the same LLM concurrency / HTTP pool considerations as the Map phase, plus DB connection pool size. Same multiplier caveat as IngestMapParallel.
      - `max_pages_per_ingest` integer — MaxPagesPerIngest limits pages created/updated per ingest operation (0 = no limit)
      - `synthesis_model_id` string — SynthesisModelID is the LLM model ID used for wiki page generation and updates
  - `description` string
  - `name` string, required

## Response `200`

更新后的知识库

- object

## Other responses

- `400` — 请求参数错误

---

[API](https://skmtc.net/tencentblueking/apis/weknora-api.md) · [All operations](https://skmtc.net/tencentblueking/apis/weknora-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tencentblueking/weknora-api/versions/d6921ae22ce0/schema)
