mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-21 23:21:04 +08:00
Feat: Add a data compilation layer. (#16777)
### Summary Feat: Add a data compilation layer.
This commit is contained in:
74
web/src/interfaces/database/compilation-template.ts
Normal file
74
web/src/interfaces/database/compilation-template.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
export interface ICompilationTemplateField {
|
||||
type?: string;
|
||||
description?: string;
|
||||
rule?: string;
|
||||
[key: string]: string | undefined;
|
||||
}
|
||||
|
||||
export interface ICompilationTemplateSection {
|
||||
description?: string;
|
||||
fields: ICompilationTemplateField[];
|
||||
}
|
||||
|
||||
export interface ICompilationTemplateRaptorConfig {
|
||||
prompt?: string;
|
||||
max_token?: number;
|
||||
threshold?: number;
|
||||
rechunk?: boolean;
|
||||
}
|
||||
|
||||
export interface ICompilationTemplateConfig {
|
||||
kind?: string;
|
||||
llm_id?: string;
|
||||
entity?: ICompilationTemplateSection;
|
||||
relation?: ICompilationTemplateSection;
|
||||
raptor?: ICompilationTemplateRaptorConfig;
|
||||
global_rules?: string;
|
||||
[section: string]:
|
||||
| ICompilationTemplateSection
|
||||
| ICompilationTemplateRaptorConfig
|
||||
| string
|
||||
| boolean
|
||||
| undefined;
|
||||
}
|
||||
|
||||
export interface ICompilationTemplate {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
kind: string;
|
||||
config: ICompilationTemplateConfig;
|
||||
create_time?: number;
|
||||
update_time?: number;
|
||||
}
|
||||
|
||||
export interface ICompilationTemplateListResult {
|
||||
templates: ICompilationTemplate[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface ICompilationTemplateBuiltin {
|
||||
id: string;
|
||||
kind: string;
|
||||
display_name: string;
|
||||
description: string;
|
||||
config: ICompilationTemplateConfig;
|
||||
}
|
||||
|
||||
export interface ICompilationTemplateGroup {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
scope?: string;
|
||||
avatar?: string;
|
||||
create_time?: number;
|
||||
update_time?: number;
|
||||
templates: ICompilationTemplate[];
|
||||
}
|
||||
|
||||
export interface IWikiPreset {
|
||||
id: string;
|
||||
topic: string;
|
||||
instruction: string;
|
||||
page_example: string;
|
||||
}
|
||||
29
web/src/interfaces/database/dataset-skill.ts
Normal file
29
web/src/interfaces/database/dataset-skill.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
export interface DatasetSkillTreeNode {
|
||||
skill_kwd: string;
|
||||
md_with_weight?: string;
|
||||
children_kwd?: DatasetSkillTreeNode[];
|
||||
}
|
||||
|
||||
export interface DatasetSkillTree {
|
||||
id: string;
|
||||
kb_id: string;
|
||||
doc_id: string;
|
||||
compile_kwd: 'skill_all';
|
||||
skill_with_weight: DatasetSkillTreeNode[];
|
||||
}
|
||||
|
||||
export interface DatasetSkillPage {
|
||||
id?: string;
|
||||
kb_id?: string;
|
||||
doc_id?: string;
|
||||
compile_kwd?: 'skill';
|
||||
skill_kwd: string;
|
||||
depth_int?: number;
|
||||
children_kwd?: string[];
|
||||
source_doc_ids?: string[];
|
||||
md_with_weight: string;
|
||||
}
|
||||
|
||||
export interface HasAnySkillResponse {
|
||||
has: boolean;
|
||||
}
|
||||
@@ -222,3 +222,69 @@ export interface IKnowledgeGraph {
|
||||
graph: Record<string, any>;
|
||||
mind_map: import('@antv/g6/lib/types').TreeData;
|
||||
}
|
||||
|
||||
export interface IArtifact {
|
||||
slug: string;
|
||||
title: string;
|
||||
page_type?: string;
|
||||
summary?: string;
|
||||
}
|
||||
|
||||
export interface IArtifactTopic {
|
||||
topic: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
}
|
||||
|
||||
export interface IArtifactPage {
|
||||
slug: string;
|
||||
title: string;
|
||||
page_type: string;
|
||||
content_md_rendered: string;
|
||||
summary: string;
|
||||
entity_names: string[];
|
||||
outlinks: string[];
|
||||
related_kb_pages: string[];
|
||||
source_chunk_ids: string[];
|
||||
source_doc_ids: string[];
|
||||
}
|
||||
|
||||
export interface IWikiCommit {
|
||||
id: string;
|
||||
title: string;
|
||||
comments: string;
|
||||
user_id: string;
|
||||
create_time: number;
|
||||
create_date: string;
|
||||
user_nickname: string;
|
||||
}
|
||||
|
||||
export interface IWikiCommitDetail extends IWikiCommit {
|
||||
diff: string;
|
||||
content_after: string;
|
||||
}
|
||||
|
||||
export interface IWikiCommitListResponse {
|
||||
total: number;
|
||||
items: IWikiCommit[];
|
||||
}
|
||||
|
||||
export interface IArtifactGraphEntity {
|
||||
slug: string;
|
||||
name: string;
|
||||
aliases: string[];
|
||||
description: string;
|
||||
type: string;
|
||||
weight: number;
|
||||
source_chunk_ids?: string[];
|
||||
}
|
||||
|
||||
export interface IArtifactGraphRelation {
|
||||
from: string;
|
||||
to: string;
|
||||
}
|
||||
|
||||
export interface IArtifactGraph {
|
||||
entities: IArtifactGraphEntity[];
|
||||
relations: IArtifactGraphRelation[];
|
||||
}
|
||||
|
||||
32
web/src/interfaces/database/document-structure.ts
Normal file
32
web/src/interfaces/database/document-structure.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { CompilationTemplateKind } from '@/constants/compilation';
|
||||
|
||||
export type StructureTemplateKind = CompilationTemplateKind | 'raptor';
|
||||
|
||||
export interface IStructureGraphEntity {
|
||||
id?: string;
|
||||
name?: string;
|
||||
aliases?: string[];
|
||||
description?: string;
|
||||
discription?: string;
|
||||
mention_count?: number;
|
||||
source_chunk_ids?: string[];
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface IStructureGraphRelation {
|
||||
from: string;
|
||||
to: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface IStructureGraphTemplate {
|
||||
kind: StructureTemplateKind;
|
||||
template_id: string;
|
||||
template_name: string;
|
||||
entities: IStructureGraphEntity[];
|
||||
relations: IStructureGraphRelation[];
|
||||
}
|
||||
|
||||
export interface IStructureGraphResponse {
|
||||
templates: IStructureGraphTemplate[];
|
||||
}
|
||||
@@ -60,6 +60,7 @@ export interface IParserConfig {
|
||||
enum?: string[];
|
||||
}>;
|
||||
enable_metadata?: boolean;
|
||||
compilation_template_group_id?: string[];
|
||||
}
|
||||
|
||||
interface Raptor {
|
||||
|
||||
58
web/src/interfaces/request/compilation-template.ts
Normal file
58
web/src/interfaces/request/compilation-template.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
export interface IFetchCompilationTemplatesRequestParams {
|
||||
keywords?: string;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
kind?: string;
|
||||
}
|
||||
|
||||
export interface ICompilationTemplateSectionRequest {
|
||||
description?: string;
|
||||
fields: Array<Record<string, string>>;
|
||||
}
|
||||
|
||||
export interface ICompilationTemplateRaptorConfigRequest {
|
||||
prompt?: string;
|
||||
max_token?: number;
|
||||
threshold?: number;
|
||||
rechunk?: boolean;
|
||||
}
|
||||
|
||||
export interface ICompilationTemplateConfigRequest {
|
||||
kind?: string;
|
||||
llm_id?: string;
|
||||
entity?: ICompilationTemplateSectionRequest;
|
||||
relation?: ICompilationTemplateSectionRequest;
|
||||
raptor?: ICompilationTemplateRaptorConfigRequest;
|
||||
global_rules?: string;
|
||||
[section: string]:
|
||||
| ICompilationTemplateSectionRequest
|
||||
| ICompilationTemplateRaptorConfigRequest
|
||||
| string
|
||||
| boolean
|
||||
| undefined;
|
||||
}
|
||||
|
||||
export interface ICreateCompilationTemplateRequestBody {
|
||||
name: string;
|
||||
description?: string;
|
||||
kind: string;
|
||||
config: ICompilationTemplateConfigRequest;
|
||||
}
|
||||
|
||||
export type IUpdateCompilationTemplateRequestBody =
|
||||
Partial<ICreateCompilationTemplateRequestBody>;
|
||||
|
||||
export interface ICreateCompilationTemplateGroupRequestBody {
|
||||
name: string;
|
||||
description?: string;
|
||||
avatar?: string;
|
||||
templates: Array<{
|
||||
name?: string;
|
||||
description?: string;
|
||||
kind: string;
|
||||
config: ICompilationTemplateConfigRequest;
|
||||
}>;
|
||||
}
|
||||
|
||||
export type IUpdateCompilationTemplateGroupRequestBody =
|
||||
Partial<ICreateCompilationTemplateGroupRequestBody>;
|
||||
@@ -22,6 +22,7 @@ export interface IChangeParserConfigRequestBody {
|
||||
clustering_method?: 'gmm' | 'ahc';
|
||||
tree_builder?: 'raptor' | 'psi';
|
||||
};
|
||||
compilation_template_group_id?: string[];
|
||||
// Metadata fields
|
||||
metadata?: Array<{
|
||||
key?: string;
|
||||
|
||||
@@ -39,4 +39,35 @@ export interface IFetchDocumentListRequestBody {
|
||||
run_status?: string[];
|
||||
return_empty_metadata?: boolean;
|
||||
metadata?: Record<string, string[]>;
|
||||
ids?: string[];
|
||||
}
|
||||
|
||||
export interface IFetchArtifactListRequestParams {
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
keywords?: string;
|
||||
page_type?: string;
|
||||
topic?: string;
|
||||
}
|
||||
|
||||
export interface IFetchArtifactTopicListRequestParams {
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
|
||||
export interface IFetchArtifactGraphRequestParams {
|
||||
node?: string;
|
||||
}
|
||||
|
||||
export interface IUpdateArtifactPageRequestBody {
|
||||
content_md: string;
|
||||
comments: string;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export interface IUpdateArtifactPageRequestParams {
|
||||
pageType: string;
|
||||
slug: string;
|
||||
body: IUpdateArtifactPageRequestBody;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user