v50

latestSwagger 2.0raw.githubusercontent.com2026-08-07307239824.1 KB
知识库

创建知识库

创建新的知识库

post/knowledge-bases

Request body

chunk_countinteger

Chunk count (not stored in database, calculated on query)

created_atstring

Creation time of the knowledge base

creator_idstring

CreatorID records the user ID of whoever originally created the KB. Used by the workspace-level RBAC middleware to let Contributors edit their own KBs without granting them access to everyone else's. Nullable for backward compatibility with rows created before the RBAC migration backfilled the column to the workspace Owner.

creator_namestring

CreatorName 是 CreatorID 对应用户的展示名(username / email 等), 仅在列表场景由 handler 批量回填,不落库;为空表示创建者无法解析(用户已删除、 CreatorID 为空的老数据等)。前端用它在卡片来源徽章上做 mine vs workspace 的二分。

descriptionstring

Description of the knowledge base

embedding_model_idstring

ID of the embedding model

idstring

Unique identifier of the knowledge base

is_pinnedboolean

IsPinned and PinnedAt are computed per-caller from user_kb_pins (see migration 000050). They used to be stored on the row itself, which made pinning a workspace-wide ordering decision gated behind the kb-edit RBAC guard. The columns are still present in legacy schemas for rollback safety but are no longer read or written by the application — both fields are tagged gorm:"-" so GORM ignores them on every CRUD call and the list handler stamps them after enriching with the caller's pin set.

is_processingboolean

IsProcessing indicates if there is a processing import task (for FAQ type knowledge bases)

is_temporaryboolean

Whether this knowledge base is temporary (ephemeral) and should be hidden from UI

knowledge_countinteger

Knowledge count (not stored in database, calculated on query)

namestring

Name of the knowledge base

pinned_atstring

PinnedAt records when the current caller pinned this knowledge base; nil when they have not.

processing_countinteger

ProcessingCount indicates the number of knowledge items being processed (for document type knowledge bases)

share_countinteger

ShareCount indicates the number of organizations this knowledge base is shared with (not stored in database)

storage_backend_idstring

StorageBackendID binds this KB to one concrete storage instance. The legacy provider field remains readable during migration only.

summary_model_idstring

Summary model ID

tenant_idinteger

Workspace ID

typestring

Type of the knowledge base (document, faq, etc.)

updated_atstring

Last updated time of the knowledge base

vector_store_idstring

VectorStoreID references the VectorStore this knowledge base is bound to. When nil, the KB falls back to the workspace's effective engines derived from the RETRIEVE_DRIVER environment variable (env store flow). This field is set once at creation time and must not be modified afterwards; enforcement lives at the GORM layer (<-:create) plus the service-layer KB update path, which omits this field from its update DTO.

Response

创建的知识库

object required