feat: 重构图谱抽取 — 支持建筑规范文档的 8 种实体类型
GraphRAG CI/CD / build-and-deploy (push) Successful in 6m15s

- 实体类型改为:构件/设备/设施/指标/场所/材料/措施/条款
- 中文 prompt + 建筑规范领域 Few-shot 示例
- 前端图谱颜色、筛选项同步更新
- QA agent 系统提示词适配建筑规范领域
This commit is contained in:
2026-06-18 16:30:58 +08:00
parent 4f203e3b56
commit a46ceb94de
6 changed files with 77 additions and 39 deletions
@@ -5,7 +5,7 @@ import { ZoomIn, ZoomOut, Maximize2, Search, Download, Image, X, MessageSquare,
import { useAppState, type KGNode } from '../../store';
import { TYPE_COLORS } from '../../mock-data';
const ENTITY_TYPES = ['TECHNOLOGY', 'CONCEPT', 'PERSON', 'ORGANIZATION', 'LOCATION'] as const;
const ENTITY_TYPES = ['构件', '设备', '设施', '指标', '场所', '材料', '措施', '条款', 'TECHNOLOGY', 'CONCEPT', 'PERSON', 'ORGANIZATION', 'LOCATION'] as const;
const CONFIDENCE_LEVELS = ['match_exact', 'match_greater', 'match_lesser', 'match_fuzzy'] as const;
export function KGExplorer() {
@@ -6,7 +6,7 @@ import { useAppState, mapApiNode, mapApiEdge, type KGNode } from '../../store';
import { api, ApiError } from '../../api';
import { TYPE_COLORS } from '../../mock-data';
const ENTITY_TYPES_OPTIONS = ['全部类型', 'TECHNOLOGY', 'CONCEPT', 'PERSON', 'ORGANIZATION', 'LOCATION'];
const ENTITY_TYPES_OPTIONS = ['全部类型', '构件', '设备', '设施', '指标', '场所', '材料', '措施', '条款', 'TECHNOLOGY', 'CONCEPT', 'PERSON', 'ORGANIZATION', 'LOCATION'];
export function SearchPage() {
const { nodes, edges, getNeighbors } = useAppState();
+9 -1
View File
@@ -3,7 +3,7 @@
export interface KGNode {
id: string;
name: string;
type: 'TECHNOLOGY' | 'CONCEPT' | 'PERSON' | 'ORGANIZATION' | 'LOCATION';
type: '构件' | '设备' | '设施' | '指标' | '场所' | '材料' | '措施' | '条款' | 'TECHNOLOGY' | 'CONCEPT' | 'PERSON' | 'ORGANIZATION' | 'LOCATION';
page: number;
confidence: 'match_exact' | 'match_greater' | 'match_lesser' | 'match_fuzzy';
degree: number;
@@ -66,6 +66,14 @@ export interface HistoryItem {
// Entity type colors
export const TYPE_COLORS: Record<string, string> = {
'构件': '#58a6ff',
'设备': '#ff7b72',
'设施': '#d29922',
'指标': '#3fb950',
'场所': '#bc8cff',
'材料': '#ffa657',
'措施': '#f0f6fc',
'条款': '#8b949e',
TECHNOLOGY: '#58a6ff',
CONCEPT: '#bc8cff',
PERSON: '#3fb950',
+4 -4
View File
@@ -6,7 +6,7 @@ import { api, type ApiDoc, type ApiKGNode, type ApiKGEdge, ApiError } from './ap
export interface KGNode {
id: string;
name: string;
type: 'TECHNOLOGY' | 'CONCEPT' | 'PERSON' | 'ORGANIZATION' | 'LOCATION';
type: '构件' | '设备' | '设施' | '指标' | '场所' | '材料' | '措施' | '条款' | 'TECHNOLOGY' | 'CONCEPT' | 'PERSON' | 'ORGANIZATION' | 'LOCATION';
page: number;
confidence: 'match_exact' | 'match_greater' | 'match_lesser' | 'match_fuzzy';
degree: number;
@@ -169,9 +169,9 @@ const DEFAULT_STATS: StatsData = { kg_nodes: 0, kg_edges: 0, documents: 0, queri
const SUGGESTED_PROMPTS = [
'给我一个知识图谱的概览',
'列出所有 TECHNOLOGY 实体',
'GraphRAG 与知识图谱有什么关系?',
'什么是检索增强生成',
'列出所有 构件 实体',
'列出所有 设备 实体',
'文档中有哪些防火措施',
];
// ─── Provider ─────────────────────────────────────────────────────────────────