feat(knowledge-config): enhance knowledge configuration form with accordion sections

- Add accordion sections for general, page rank, RAPTOR, and GraphRAG configurations
- Implement detailed form controls for each configuration section
- Update parser config interfaces to support new configuration options
This commit is contained in:
2025-10-14 19:15:32 +08:00
parent 9f6785672f
commit 486815d83e
3 changed files with 597 additions and 208 deletions

View File

@@ -1,5 +1,56 @@
import type { RunningStatus } from '@/constants/knowledge';
/**
{
"avatar": "data:image/png;base64,iVBORw0K
"chunk_num": 1180,
"create_time": 1759986452748,
"description": " 213213",
"doc_num": 16,
"embd_id": "",
"id": "dcc2871aa4cd11f08d4116ac85b1de0a",
"language": "English",
"name": "k1123",
"pagerank": 0,
"parser_config": {
"auto_keywords": 0,
"auto_questions": 0,
"chunk_token_num": 512,
"delimiter": "\n",
"graphrag": {
"entity_types": [
"organization",
"person",
"geo",
"event",
"category"
],
"method": "light",
"use_graphrag": true
},
"html4excel": false,
"layout_recognize": "Plain Text",
"raptor": {
"max_cluster": 64,
"max_token": 256,
"prompt": "\u8bf7\u603b\u7ed3\u4ee5\u4e0b\u6bb5\u843d\u3002 \u5c0f\u5fc3\u6570\u5b57\uff0c\u4e0d\u8981\u7f16\u9020\u3002 \u6bb5\u843d\u5982\u4e0b\uff1a\n {cluster_content}\n\u4ee5\u4e0a\u5c31\u662f\u4f60\u9700\u8981\u603b\u7ed3\u7684\u5185\u5bb9\u3002",
"random_seed": 0,
"threshold": 0.1,
"use_raptor": false
},
"topn_tags": 3
},
"parser_id": "naive",
"permission": "team",
"size": 56819092,
"token_num": 293067,
"update_time": 1760436169574
}
*/
/**
* 知识库接口定义
* 包含知识库的基本信息、配置和状态
@@ -26,7 +77,7 @@ export interface IKnowledge {
/** 知识库名称 */
name: string;
/** 解析器配置 */
parser_config: ParserConfig;
parser_config: IParserConfig;
/** 解析器ID */
parser_id: string;
/** 管道ID */
@@ -83,17 +134,60 @@ export interface IKnowledgeResult {
/**
* Raptor配置接口
* 用于配置是否启用Raptor功能
{
"max_cluster": 64,
"max_token": 256,
"prompt": "\u8bf7\u603b\u7ed3\u4ee5\u4e0b\u6bb5\u843d\u3002
\u5c0f\u5fc3\u6570\u5b57\uff0c\u4e0d\u8981\u7f16\u9020\u3002 \u6bb5\u843d\u5982\u4e0b\uff1a\n
{cluster_content}\n\u4ee5\u4e0a\u5c31\u662f\u4f60\u9700\u8981\u603b\u7ed3\u7684\u5185\u5bb9\u3002",
"random_seed": 0,
"threshold": 0.1,
"use_raptor": false
}
*/
export interface Raptor {
export interface IRaptor {
/** 是否使用Raptor */
use_raptor: boolean;
/** 最大集群数,可选 */
max_cluster?: number;
/** 最大令牌数,可选 */
max_token?: number;
/** 提示模板,可选 */
prompt?: string;
/** 随机种子,可选 */
random_seed?: number;
/** 阈值,可选 */
threshold?: number;
}
/**
* GraphRAG配置接口
* 用于配置是否启用GraphRAG功能
{
"entity_types": [
"organization",
"person",
"geo",
"event",
"category"
],
"method": "light",
"use_graphrag": true
}
*/
export interface IGraphrag {
use_graphrag: boolean;
/** 实体类型列表,可选 */
entity_types?: string[];
/** 方法,可选 */
method?: string;
}
/**
* 解析器配置接口
* 定义文档解析的各种参数和选项
*/
export interface ParserConfig {
export interface IParserConfig {
/** 起始页码,可选 */
from_page?: number;
/** 结束页码,可选 */
@@ -111,13 +205,13 @@ export interface ParserConfig {
/** 是否启用布局识别,可选 */
layout_recognize?: boolean;
/** Raptor配置可选 */
raptor?: Raptor;
raptor?: IRaptor;
/** 标签知识库ID列表可选 */
tag_kb_ids?: string[];
/** 顶部标签数量,可选 */
topn_tags?: number;
/** GraphRAG配置可选 */
graphrag?: { use_graphrag?: boolean };
graphrag?: IGraphrag;
}
/**