feat(web): extraction engine add ontology
This commit is contained in:
@@ -1588,6 +1588,11 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re
|
|||||||
creating_nodes_edges_desc: 'Entity relationship creation completed, {{num}} relationships in total',
|
creating_nodes_edges_desc: 'Entity relationship creation completed, {{num}} relationships in total',
|
||||||
deduplication_desc: 'Deduplication and disambiguation completed, {{count}} unique entities in total',
|
deduplication_desc: 'Deduplication and disambiguation completed, {{count}} unique entities in total',
|
||||||
custom_text: 'Debug Text',
|
custom_text: 'Debug Text',
|
||||||
|
ontologyCoverage: 'Ontology Type',
|
||||||
|
entity_total: 'Total {{num}} entities',
|
||||||
|
scene_type_distribution: 'Scene Type Distribution',
|
||||||
|
general_type_distribution: 'General Type Distribution',
|
||||||
|
unmatched: 'Unmatched',
|
||||||
},
|
},
|
||||||
memoryConversation: {
|
memoryConversation: {
|
||||||
searchPlaceholder: 'Enter user ID...',
|
searchPlaceholder: 'Enter user ID...',
|
||||||
|
|||||||
@@ -1668,6 +1668,11 @@ export const zh = {
|
|||||||
creating_nodes_edges_desc: '实体关系创建完成,共{{num}}条关系',
|
creating_nodes_edges_desc: '实体关系创建完成,共{{num}}条关系',
|
||||||
deduplication_desc: '去重消歧完成,最终{{count}}个唯一实体',
|
deduplication_desc: '去重消歧完成,最终{{count}}个唯一实体',
|
||||||
custom_text: '调试文本',
|
custom_text: '调试文本',
|
||||||
|
ontologyCoverage: '本体类型',
|
||||||
|
entity_total: '一共{{num}}个实体',
|
||||||
|
scene_type_distribution: '场景类型',
|
||||||
|
general_type_distribution: '通用类型',
|
||||||
|
unmatched: '未匹配',
|
||||||
},
|
},
|
||||||
memoryConversation: {
|
memoryConversation: {
|
||||||
chatEmpty:'有什么我可以帮您的吗?',
|
chatEmpty:'有什么我可以帮您的吗?',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-03 17:30:11
|
* @Date: 2026-02-03 17:30:11
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-02-04 10:08:49
|
* @Last Modified time: 2026-02-09 21:04:14
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Result Component
|
* Result Component
|
||||||
@@ -21,7 +21,7 @@ import type { AnyObject } from 'antd/es/_util/type';
|
|||||||
import Card from './Card'
|
import Card from './Card'
|
||||||
import RbCard from '@/components/RbCard/Card'
|
import RbCard from '@/components/RbCard/Card'
|
||||||
import RbAlert from '@/components/RbAlert'
|
import RbAlert from '@/components/RbAlert'
|
||||||
import type { TestResult } from '../types'
|
import type { TestResult, OntologyCoverage } from '../types'
|
||||||
import { pilotRunMemoryExtractionConfig } from '@/api/memory'
|
import { pilotRunMemoryExtractionConfig } from '@/api/memory'
|
||||||
import { type SSEMessage } from '@/utils/stream'
|
import { type SSEMessage } from '@/utils/stream'
|
||||||
import Tag, { type TagProps } from '@/components/Tag'
|
import Tag, { type TagProps } from '@/components/Tag'
|
||||||
@@ -78,6 +78,7 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
|
|||||||
const [knowledgeExtraction, setKnowledgeExtraction] = useState<ModuleItem>(initObj as ModuleItem)
|
const [knowledgeExtraction, setKnowledgeExtraction] = useState<ModuleItem>(initObj as ModuleItem)
|
||||||
const [creatingNodesEdges, setCreatingNodesEdges] = useState<ModuleItem>(initObj as ModuleItem)
|
const [creatingNodesEdges, setCreatingNodesEdges] = useState<ModuleItem>(initObj as ModuleItem)
|
||||||
const [deduplication, setDeduplication] = useState<ModuleItem>(initObj as ModuleItem)
|
const [deduplication, setDeduplication] = useState<ModuleItem>(initObj as ModuleItem)
|
||||||
|
const [ontologyCoverage, setOntologyCoverage] = useState<OntologyCoverage>({} as OntologyCoverage)
|
||||||
|
|
||||||
const [runForm] = Form.useForm()
|
const [runForm] = Form.useForm()
|
||||||
|
|
||||||
@@ -181,6 +182,7 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
|
|||||||
break
|
break
|
||||||
case 'result': // Result
|
case 'result': // Result
|
||||||
setTestResult(data.data?.extracted_result)
|
setTestResult(data.data?.extracted_result)
|
||||||
|
setOntologyCoverage(data.data?.ontology_coverage)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -284,8 +286,8 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
|
|||||||
headerType="borderL"
|
headerType="borderL"
|
||||||
headerClassName="rb:before:bg-[#155EEF]!"
|
headerClassName="rb:before:bg-[#155EEF]!"
|
||||||
>
|
>
|
||||||
{knowledgeExtraction.data.map(vo =>
|
{knowledgeExtraction.data.map((vo, index) =>
|
||||||
<div key={vo.statement_index} className="rb:mb-3 rb:text-[12px] rb:text-[#5B6167] rb:leading-4 rb:font-regular">{vo.statement}</div>
|
<div key={index} className="rb:mb-3 rb:text-[12px] rb:text-[#5B6167] rb:leading-4 rb:font-regular">{vo.statement}</div>
|
||||||
)}
|
)}
|
||||||
{formatTime(knowledgeExtraction)}
|
{formatTime(knowledgeExtraction)}
|
||||||
{knowledgeExtraction.result && <RbAlert color="blue" icon={<CheckCircleFilled />} className="rb:mt-3">
|
{knowledgeExtraction.result && <RbAlert color="blue" icon={<CheckCircleFilled />} className="rb:mt-3">
|
||||||
@@ -450,6 +452,36 @@ const Result: FC<ResultProps> = ({ loading, handleSave }) => {
|
|||||||
</RbAlert>
|
</RbAlert>
|
||||||
</RbCard>
|
</RbCard>
|
||||||
}
|
}
|
||||||
|
{ontologyCoverage && Object.keys(ontologyCoverage).length > 0 &&
|
||||||
|
<RbCard
|
||||||
|
title={<>{t('memoryExtractionEngine.ontologyCoverage')}({ontologyCoverage.total_entities})</>}
|
||||||
|
headerType="borderL"
|
||||||
|
headerClassName="rb:before:bg-[#369F21]!"
|
||||||
|
>
|
||||||
|
<div className="rb:grid rb:grid-cols-2 rb:gap-3">
|
||||||
|
{(['scene_type_distribution', 'general_type_distribution', 'unmatched'] as const).map((key, idx) => {
|
||||||
|
if (!ontologyCoverage[key]) return null
|
||||||
|
return (
|
||||||
|
<div key={idx} className="rb:text-[12px]">
|
||||||
|
<div className="rb:text-[#369F21] rb:font-medium">{t(`memoryExtractionEngine.${key}`)}({ontologyCoverage[key].type_count})</div>
|
||||||
|
<div>{t('memoryExtractionEngine.entity_total', { num: ontologyCoverage[key].entity_total })}</div>
|
||||||
|
<div>
|
||||||
|
{ontologyCoverage[key].types.map((type, index) => {
|
||||||
|
if (!type.type || type.type === '') return null
|
||||||
|
return (
|
||||||
|
<div key={index} className="rb:text-[#5B6167] rb:font-regular rb:leading-4">
|
||||||
|
-{type.type}({type.count})
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</RbCard>
|
||||||
|
}
|
||||||
|
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* @Author: ZhaoYing
|
* @Author: ZhaoYing
|
||||||
* @Date: 2026-02-03 17:29:55
|
* @Date: 2026-02-03 17:29:55
|
||||||
* @Last Modified by: ZhaoYing
|
* @Last Modified by: ZhaoYing
|
||||||
* @Last Modified time: 2026-02-03 17:29:55
|
* @Last Modified time: 2026-02-09 20:56:31
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Memory Extraction Engine Configuration Form Types
|
* Memory Extraction Engine Configuration Form Types
|
||||||
@@ -106,4 +106,17 @@ export interface TestResult {
|
|||||||
predicate: string;
|
predicate: string;
|
||||||
object: string;
|
object: string;
|
||||||
}[];
|
}[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OntologyCoverageItem {
|
||||||
|
type_count: number;
|
||||||
|
entity_total: number;
|
||||||
|
types: Array<{ type: string; count: number; }>
|
||||||
|
}
|
||||||
|
export interface OntologyCoverage {
|
||||||
|
scene_type_distribution: OntologyCoverageItem;
|
||||||
|
general_type_distribution: OntologyCoverageItem;
|
||||||
|
unmatched: OntologyCoverageItem;
|
||||||
|
total_entities: number;
|
||||||
|
time: number;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user