mateclaw/mateclaw-server/src/main/java/vip/mate/wiki/model/WikiKnowledgeBaseEntity.java
倪程伟 18daad79b2
feat(wiki): unify raw materials & source watcher into a Sources tab with per-KB auto-sync (#316)
* feat(wiki): unify raw materials & source watcher into a Sources tab with per-KB auto-sync

The raw-material directory scan and the Advanced "source watcher" sub-tab were
the same engine (same kb.sourceDirectory, same WikiDirectoryScanService) split
across two surfaces with two editable directory inputs. Merge them into one
"Sources" tab (upload / paste / directory manual scan + auto-sync toggle +
the raw-material list) and drop the watcher sub-tab from Advanced.

Auto-sync is now per-KB opt-in: a new watcher_enabled column (V146) gates the
periodic scan per knowledge base. The server-global mate.wiki.watcher-enabled
stays as an ops master switch — a KB is auto-scanned only when both are on
(AND). Manual scans are unaffected. Scan interval stays global for now
(tracked separately).

Closes matevip/mateclaw#314

* docs(wiki): document source-watcher global switch env vars

Expose MATE_WIKI_WATCHER_ENABLED / MATE_WIKI_WATCHER_INTERVAL_MS as
explicit placeholders in application-mysql.yml, .env.example and
docker-compose.yml, mirroring MATE_WIKI_ALLOWED_SOURCE_ROOTS. Notes the
AND semantics (global ops gate + per-KB toggle) so operators know the
global switch alone is not sufficient.
2026-06-11 09:29:26 +08:00

72 lines
1.9 KiB
Java
Raw 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.

package vip.mate.wiki.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.time.LocalDateTime;
/**
* Wiki 知识库实体
*
* @author MateClaw Team
*/
@Data
@TableName("mate_wiki_knowledge_base")
public class WikiKnowledgeBaseEntity {
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/** 知识库名称 */
private String name;
/** 描述 */
private String description;
/** 关联的 Agent ID可选 */
private Long agentId;
/** Wiki 处理规则配置WIKI.md 等效物) */
@TableField(updateStrategy = FieldStrategy.ALWAYS)
private String configContent;
/** 关联的本地目录路径(可选,用于批量扫描导入) */
private String sourceDirectory;
/**
* 是否对该知识库启用自动同步(周期扫描 sourceDirectory。1=开0=关。
* 自动扫描需"全局总闸 mate.wiki.watcher-enabled 开 且 本字段为 1"AND 语义);
* 手动扫描不受此字段影响。
*/
private Integer watcherEnabled;
/** 状态active / processing / error */
private String status;
/** Wiki 页面数量 */
private Integer pageCount;
/** 原始材料数量 */
private Integer rawCount;
/** 所属工作区 ID默认 1 = default */
private Long workspaceId;
/**
* 绑定的 Embedding 模型 IDmate_model_config.idmodel_type='embedding')。
* <p>
* NULL = 使用系统默认mate_system_setting 的 embedding.default.model.id
* 再无则取任意 enabled 的 embedding 模型,最终全无则语义搜索降级为不可用。
*/
@TableField(updateStrategy = FieldStrategy.ALWAYS)
private Long embeddingModelId;
@TableField(fill = FieldFill.INSERT)
private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime updateTime;
private Integer deleted;
}