mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 11:13:43 +08:00
Add an opt-in named-entity extraction pass so the wiki knowledge graph captures fine-grained entities (people, organizations, locations, ...) and their relations, not just page-level link relations. - new tables mate_wiki_entity / _mention / _relation (h2/mysql/kingbase) - structured LLM extraction per chunk with entity resolution (normalized-key dedup + embedding near-merge), mention/relation persistence and page linking via chunk citations - per-KB opt-in toggle (off by default); async dispatch after embedding - read API: entity list, KB graph, entity ego-graph, manual extract - UI: entity-layer toggle in the graph view + KB config toggle - replace inline fully-qualified class names with imports in WikiProcessingService Closes #336
78 lines
2.9 KiB
Java
78 lines
2.9 KiB
Java
package vip.mate.wiki.job;
|
|
|
|
import lombok.Data;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* RFC-030: Per-KB processing configuration POJO, deserialized from
|
|
* {@link vip.mate.wiki.model.WikiKnowledgeBaseEntity#getConfigContent()}.
|
|
*/
|
|
@Data
|
|
public class WikiKbConfig {
|
|
|
|
/**
|
|
* RFC-051: ingest pipeline mode for this KB. {@code "lazy"} skips page
|
|
* generation on upload (chunk + embed only); {@code "eager"} runs the
|
|
* legacy heavy ingest pipeline. {@code null} means caller should apply
|
|
* its own default. PR-1a only adds the field; the lazy branch lands
|
|
* in PR-1b.
|
|
*/
|
|
private String ingestMode;
|
|
|
|
/**
|
|
* RFC-051: KB-level default chat model. Used by routing as the
|
|
* intermediate fallback between {@link #stepModels} and the system
|
|
* default. {@code null} means the caller should fall through to the
|
|
* system default. The frontend already writes this field; before
|
|
* PR-1a it had no Java field to deserialize into and was silently
|
|
* dropped.
|
|
*/
|
|
private Long wikiDefaultModelId;
|
|
|
|
/** Per-step model overrides: "heavy_ingest.create_page" → modelId */
|
|
private Map<String, Long> stepModels;
|
|
|
|
/** Global fallback model chain for all steps in this KB */
|
|
private List<Long> fallbackModelIds;
|
|
|
|
/**
|
|
* RFC-051 PR-6b follow-up: per-KB opt-in for structured route output.
|
|
* <p>
|
|
* Different KBs run different chat models — DashScope and Anthropic
|
|
* follow the format hint reliably; weaker locally-served Ollama models
|
|
* may not. Keeping the flag per-KB lets users flip it where it pays
|
|
* off. {@code null} (the common case) falls back to
|
|
* {@link vip.mate.wiki.WikiProperties#isUseStructuredRoute()}.
|
|
*/
|
|
private Boolean useStructuredRoute;
|
|
|
|
/**
|
|
* KB-level default read policy applied when an agent has no
|
|
* {@code mate_wiki_agent_page_type_permission} rows for this KB.
|
|
* {@code "allow_all"} (the default when {@code null}) keeps existing
|
|
* behaviour — every agent reads every pageType. {@code "deny_all"} flips
|
|
* the default closed so a professional KB can require each readable
|
|
* pageType to be granted explicitly per agent.
|
|
*/
|
|
private String defaultReadPolicy;
|
|
|
|
/**
|
|
* Opt-in for entity-level knowledge graph extraction on this KB. When
|
|
* {@code true}, an extraction pass runs after ingest/embedding to pull
|
|
* named entities (person, organization, location, ...) and their
|
|
* relations from source chunks into the {@code mate_wiki_entity*} tables.
|
|
* {@code null} or {@code false} keeps the legacy behaviour (page graph
|
|
* only). Off by default because extraction adds LLM calls per chunk.
|
|
*/
|
|
private Boolean entityExtractionEnabled;
|
|
|
|
/**
|
|
* Optional whitelist of entity types to extract, e.g.
|
|
* {@code ["person","organization","location"]}. {@code null} or empty
|
|
* lets the extractor use its built-in default type set.
|
|
*/
|
|
private List<String> entityTypes;
|
|
}
|