RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix: Delete unused wiki template pages. (#18275)
balibabue4df8ebc5cee
diff --git a/web/src/hooks/logic-hooks/navigate-hooks.ts b/web/src/hooks/logic-hooks/navigate-hooks.tsindex a4cb25bd1d..3d0748f9a0 100644--- a/web/src/hooks/logic-hooks/navigate-hooks.ts+++ b/web/src/hooks/logic-hooks/navigate-hooks.ts@@ -228,32 +228,6 @@ export const useNavigatePage = () => {navigate(`${Routes.UserSetting}${Routes.Model}`);}, [navigate]);- const navigateToCompilationTemplates = useCallback(() => {- navigate(`${Routes.UserSetting}${Routes.CompilationTemplates}`);- }, [navigate]);-- const navigateToCompilationTemplate = useCallback(- (id?: string) => () => {- if (id && id !== 'create') {- navigate(`${Routes.CompilationTemplatesCreateNext}/${id}`);- } else {- navigate(Routes.CompilationTemplatesCreateNext);- }- },- [navigate],- );-- const navigateToCompilationTemplateEditNext = useCallback(- (id?: string) => () => {- if (id && id !== 'create') {- navigate(`${Routes.CompilationTemplatesEditNext}/${id}`);- } else {- navigate(Routes.CompilationTemplatesEditNext);- }- },- [navigate],- );-return {navigateToDatasetList,navigateToDataset,@@ -282,8 +256,5 @@ export const useNavigatePage = () => {navigateToMemory,navigateToMemoryList,navigateToModelSetting,- navigateToCompilationTemplates,- navigateToCompilationTemplate,- navigateToCompilationTemplateEditNext,};};diff --git a/web/src/hooks/use-compilation-template-group-request.ts b/web/src/hooks/use-compilation-template-group-request.tsindex 2fb3cf7da8..c235e2d4b5 100644--- a/web/src/hooks/use-compilation-template-group-request.ts+++ b/web/src/hooks/use-compilation-template-group-request.ts@@ -30,14 +30,9 @@ import {} from '@/services/compilation-template-group-service';import { isCreateCompilationTemplateGroup } from '@/utils/compilation-template-util';import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';-import { useDebounce } from 'ahooks';import { useCallback, useMemo } from 'react';import { useParams } from 'react-router';-import {- useGetPaginationWithRouter,- useHandleSearchChange,-} from './logic-hooks';import { AgentApiAction } from './use-agent-request';export const enum CompilationTemplateGroupApiAction {@@ -49,11 +44,6 @@ export const enum CompilationTemplateGroupApiAction {}export const CompilationTemplateGroupKeys = {- list: (keywords?: string, page?: number, pageSize?: number) =>- [- CompilationTemplateGroupApiAction.FetchCompilationTemplateGroups,- { keywords, page, pageSize },- ] as const,detail: (id?: string) =>[CompilationTemplateGroupApiAction.FetchCompilationTemplateGroup,@@ -63,60 +53,6 @@ export const CompilationTemplateGroupKeys = {[CompilationTemplateGroupApiAction.FetchCompilationTemplateGroups] as const,};-export const useFetchCompilationTemplateGroupsByPage = () => {- const { searchString, handleInputChange } = useHandleSearchChange();- const { pagination, setPagination } = useGetPaginationWithRouter();- const debouncedSearchString = useDebounce(searchString, { wait: 500 });-- const { data, isFetching: loading } = useQuery<{- groups: ICompilationTemplateGroup[];- total: number;- }>({- queryKey: CompilationTemplateGroupKeys.list(- debouncedSearchString,- pagination.current,- pagination.pageSize,- ),- initialData: {- groups: [],- total: 0,- },- gcTime: 0,- queryFn: async () => {- const { data } = await compilationTemplateGroupService.listGroups(- {- params: {- keywords: debouncedSearchString,- page: pagination.current,- page_size: pagination.pageSize,- },- },- true,- );-- return {- groups: (data?.data?.groups ?? []) as ICompilationTemplateGroup[],- total: data?.data?.total ?? 0,- };- },- });-- const currentPagination = useMemo(- () => ({ ...pagination, total: data?.total ?? 0 }),- [pagination, data?.total],- );-- return {- groups: data?.groups ?? [],- total: data?.total ?? 0,- searchString,- handleInputChange,- pagination: currentPagination,- setPagination,- loading,- };-};-export const useFetchCompilationTemplateGroup = () => {const { id } = useParams<{ id: string }>();const isCreate = isCreateCompilationTemplateGroup(id);diff --git a/web/src/locales/en.ts b/web/src/locales/en.tsindex 3f369d9ab3..cf340e2a3d 100644--- a/web/src/locales/en.ts+++ b/web/src/locales/en.ts@@ -1866,21 +1866,14 @@ Example: Virtual Hosted Style`,datasourceDescription: 'Manage your data source and connections',chatChannels: 'Chat channels',chatChannelsDescription: 'Manage your chat channel bots and credentials',- compilationTemplates: 'Compilation templates',- compilationTemplatesDescription: 'Manage your compilation templates',addTemplateGroup: 'Add template',editTemplateGroup: 'Edit template',- groupName: 'Group name',- groupNameRequired: 'Please input group name',- groupDescription: 'Group description',templateCount: '{{count}} template(s)',atLeastOneTemplateRequired: 'At least one template is required',- template: 'Template',deleteTemplateGroupModalTitle: 'Delete template group',deleteTemplateGroupModalContent:'Are you sure you want to delete this template group? This action cannot be undone.',addTemplate: 'Add template',- noTemplates: 'No compilation templates yet.',deleteTemplateModalTitle: 'Delete template',deleteTemplateModalContent:'Are you sure you want to delete this template? This action cannot be undone.',@@ -1888,10 +1881,6 @@ Example: Virtual Hosted Style`,templateName: 'Name',templateNameRequired: 'Please input template name',templateDescription: 'Description',- llmForExtraction: 'Default Model for extraction',- llmForExtractionRequired: 'Please select an LLM model',- llmForExtractionUnavailable:- 'The previously selected model has been deleted, please select another one',templateKind: 'Kind',templateKindRequired: 'Please select a kind',entitySpecification: 'Entity specification',@@ -1942,12 +1931,7 @@ Example: Virtual Hosted Style`,jsonPreview: 'JSON preview',processFlow: 'Process flow',processFlowComingSoon: 'Process flow preview coming soon',- basicInfo: 'Basic info',- basicInfoDescription: 'Template group basic information',- templateWizardConfiguration: 'Configuration',- templateWizardConfigurationDescription: 'Configure templates',blueprints: 'Blueprints',- blueprintsDescription: 'Select required blueprints',custom: 'Custom',templates: 'Templates',addFieldModalTitle: 'Add field',@@ -1955,11 +1939,6 @@ Example: Virtual Hosted Style`,selectFieldType: 'Select field type',fieldTypeExists: 'This field type already exists',blueprintsPlaceholder: 'Blueprints placeholder',- blueprintsPlaceholderDescription:- "Select or customize a specific structure from the Blueprint library on the left to define your Wiki's content framework and visual presentation.",- blueprintsPlaceholderSkip:- 'If you have no special requirements, feel free to skip this step, and the system will automatically apply the default structure.',- useBlueprint: 'Use this blueprint',channelEmptyTip:'No chat channels added yet. Select one below to connect.',availableChannels: 'Available channels',diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.tsindex 1ed9a0f5a8..56425662ab 100644--- a/web/src/locales/zh.ts+++ b/web/src/locales/zh.ts@@ -1557,30 +1557,20 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取 Entities 和 RdatasourceDescription: '管理您的数据源和连接',chatChannels: '聊天渠道',chatChannelsDescription: '管理您的聊天渠道机器人及凭证',- compilationTemplates: '知识编译模板',- compilationTemplatesDescription: '管理您的知识编译模板',addTemplateGroup: '添加模板',editTemplateGroup: '编辑模板',- groupName: '分组名称',- groupNameRequired: '请输入分组名称',- groupDescription: '分组描述',templateCount: '{{count}} 个模板',atLeastOneTemplateRequired: '至少需要一个模板',- template: '模板',deleteTemplateGroupModalTitle: '删除模板分组',deleteTemplateGroupModalContent:'确定要删除此模板分组吗?此操作无法撤销。',addTemplate: '添加模板',- noTemplates: '暂无 Compilation templates。',deleteTemplateModalTitle: '删除模板',deleteTemplateModalContent: '确定要删除此模板吗?此操作无法撤销。',editTemplate: '编辑模板',templateName: '名称',templateNameRequired: '请输入模板名称',templateDescription: '描述',- llmForExtraction: '默认提取模型',- llmForExtractionRequired: '请选择 LLM 模型',- llmForExtractionUnavailable: '之前选择的模型已被删除,请重新选择',templateKind: '类型',templateKindRequired: '请选择类型',entitySpecification: 'Entity specification',@@ -1630,12 +1620,7 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取 Entities 和 RjsonPreview: 'JSON 预览',processFlow: '流程视图',processFlowComingSoon: '流程视图预览即将到来',- basicInfo: '基本信息',- basicInfoDescription: '模板分组基础信息',- templateWizardConfiguration: '配置',- templateWizardConfigurationDescription: '管理模板的配置',blueprints: '蓝图',- blueprintsDescription: '选择所需要的蓝图',custom: '自定义',templates: '模板',addFieldModalTitle: '添加字段',@@ -1643,11 +1628,6 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取 Entities 和 RselectFieldType: '选择字段类型',fieldTypeExists: '该字段类型已存在',blueprintsPlaceholder: '蓝图占位',- blueprintsPlaceholderDescription:- '从左侧的 Blueprint 库中选择或自定义特定结构,以定义您的 Wiki 内容框架和视觉呈现。',- blueprintsPlaceholderSkip:- '如果您没有特殊要求,可以跳过此步骤,系统将自动应用默认结构。',- useBlueprint: '使用此蓝图',channelEmptyTip: '暂未添加任何聊天渠道,请从下方选择一个进行连接。',availableChannels: '可用渠道',availableChannelsDescription: '选择要添加的聊天渠道',diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/add-field-modal.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/add-field-modal.tsxdeleted file mode 100644index d23525e62e..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/add-field-modal.tsx+++ /dev/null@@ -1,190 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { SelectWithSearch } from '@/components/originui/select-with-search';-import { RAGFlowFormItem } from '@/components/ragflow-form';-import { Button } from '@/components/ui/button';-import { Form } from '@/components/ui/form';-import message from '@/components/ui/message';-import { Modal } from '@/components/ui/modal/modal';-import { Textarea } from '@/components/ui/textarea';-import { ICompilationTemplateSection } from '@/interfaces/database/compilation-template';-import { startCase } from 'lodash';-import { useCallback } from 'react';-import { useTranslation } from 'react-i18next';--import {- FieldLabelKeyMap,- FieldRequiredMessageKeyMap,-} from '@/pages/user-setting/compilation-templates/create-next/constant';--import { useAddFieldForm } from '../hooks/use-add-field-form';--type AddFieldModalProps = {- open: boolean;- onOpenChange: (open: boolean) => void;- sectionName: string;- builtinSection?: ICompilationTemplateSection;- existingFields?: Record<string, string>[];- initialField?: Record<string, string>;- onAdd: (field: Record<string, string>) => void;-};--export function AddFieldModal({- open,- onOpenChange,- sectionName,- builtinSection,- existingFields,- initialField,- onAdd,-}: AddFieldModalProps) {- const { t } = useTranslation();- const {- form,- fieldKeys,- hasTypeField,- requiredKeys,- typeOptions,- handleTypeChange,- handleSubmit,- } = useAddFieldForm({- open,- builtinSection,- existingFields,- initialField,- });-- const nonTypeKeys = fieldKeys.filter((key) => key !== 'type');-- const handleClose = useCallback(() => {- onOpenChange(false);- }, [onOpenChange]);-- const handleConfirm = useCallback(- (field: Record<string, string>) => {- onAdd(field);- onOpenChange(false);- },- [onAdd, onOpenChange],- );-- const getFieldLabel = useCallback(- (key: string) => {- return FieldLabelKeyMap[key] ? t(FieldLabelKeyMap[key]) : startCase(key);- },- [t],- );-- const getRequiredMessage = useCallback(- (key: string) => {- return FieldRequiredMessageKeyMap[key]- ? t(FieldRequiredMessageKeyMap[key])- : t('common.pleaseInput');- },- [t],- );-- const isDuplicateType = useCallback(- (typeValue: string) => {- if (!typeValue || typeValue === initialField?.type) return false;- return (existingFields ?? []).some((field) => field.type === typeValue);- },- [existingFields, initialField],- );-- const handleNoMatchEnter = useCallback(- (searchValue: string) => {- if (isDuplicateType(searchValue)) {- message.warning(t('setting.fieldTypeExists'));- return false;- }- return true;- },- [isDuplicateType, t],- );-- return (- <Modal- open={open}- onOpenChange={onOpenChange}- title={`${initialField ? t('setting.editFieldModalTitle') : t('setting.addFieldModalTitle')} - ${startCase(sectionName)}`}- size="default"- footer={- <div className="flex justify-end gap-2">- <Button type="button" variant="outline" onClick={handleClose}>- {t('common.cancel')}- </Button>- <Button type="button" onClick={handleSubmit(handleConfirm)}>- {t('common.confirm')}- </Button>- </div>- }- >- <Form {...form}>- <div className="space-y-4">- {hasTypeField && (- <RAGFlowFormItem- name="type"- label={getFieldLabel('type')}- required- rules={{- required: getRequiredMessage('type'),- validate: (value: string) =>- !isDuplicateType(value) || t('setting.fieldTypeExists'),- }}- >- {(field) => (- <SelectWithSearch- {...field}- options={typeOptions}- allowClear- onChange={(value) => {- field.onChange(value);- handleTypeChange(value);- }}- onNoMatchEnter={handleNoMatchEnter}- placeholder={t('setting.selectFieldType')}- allowCustomValue- />- )}- </RAGFlowFormItem>- )}-- {nonTypeKeys.map((key) => (- <RAGFlowFormItem- key={key}- name={key}- label={getFieldLabel(key)}- required={requiredKeys.includes(key)}- rules={- requiredKeys.includes(key)- ? { required: getRequiredMessage(key) }- : undefined- }- >- <Textarea- placeholder={t('setting.descriptionPlaceholder')}- rows={key === 'description' ? 4 : 10}- resize="vertical"- />- </RAGFlowFormItem>- ))}- </div>- </Form>- </Modal>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/basic-info-step.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/basic-info-step.tsxdeleted file mode 100644index 3e9adeda10..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/basic-info-step.tsx+++ /dev/null@@ -1,54 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { AvatarUpload } from '@/components/avatar-upload';-import { RAGFlowFormItem } from '@/components/ragflow-form';-import { Input } from '@/components/ui/input';-import { Textarea } from '@/components/ui/textarea';-import { useTranslation } from 'react-i18next';--export function BasicInfoStep() {- const { t } = useTranslation();-- return (- <div className="max-w-2xl space-y-6 p-5 mx-auto w-full">- <RAGFlowFormItem- name="name"- label={t('setting.groupName')}- required- horizontal- >- <Input placeholder={t('common.namePlaceholder')} />- </RAGFlowFormItem>-- <RAGFlowFormItem- name="description"- label={t('setting.groupDescription')}- horizontal- >- <Textarea- placeholder={t('common.descriptionPlaceholder')}- rows={3}- resize="vertical"- />- </RAGFlowFormItem>-- <RAGFlowFormItem name="avatar" label={t('setting.avatar')} horizontal>- <AvatarUpload tips={t('knowledgeConfiguration.photoTip')} />- </RAGFlowFormItem>- </div>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/blueprints-step.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/blueprints-step.tsxdeleted file mode 100644index 4ff84f62cf..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/blueprints-step.tsx+++ /dev/null@@ -1,224 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import MarkdownEditor from '@/components/markdown-editor';-import { RAGFlowFormItem } from '@/components/ragflow-form';-import { Button } from '@/components/ui/button';-import { Textarea } from '@/components/ui/textarea';-import { TreeDataItem, TreeView } from '@/components/ui/tree-view';-import { useFetchWikiPresets } from '@/hooks/use-compilation-template-request';-import { IWikiPreset } from '@/interfaces/database/compilation-template';-import { FormSchemaType } from '@/pages/user-setting/compilation-templates/create-next/schema';-import { groupBy } from 'lodash';-import { useCallback, useMemo, useState } from 'react';-import { UseFormReturn, useWatch } from 'react-hook-form';-import { useTranslation } from 'react-i18next';--import { Checkbox } from '@/components/ui/checkbox';--type WikiPresetTreeItem = TreeDataItem & {- _preset?: IWikiPreset;-};--type BlueprintsStepProps = {- form: UseFormReturn<FormSchemaType>;- selectedTemplateIndex: number;- onBack: () => void;- onSave: () => void;- isLoading: boolean;-};--function BlueprintsEmptyState() {- const { t } = useTranslation();-- return (- <div className="flex-1 flex flex-col items-center p-8 text-center">- <h3 className="text-2xl font-semibold text-text-primary mb-4">- {t('setting.blueprints')}- </h3>- <p className="text-text-secondary max-w-xl mb-2">- {t('setting.blueprintsPlaceholderDescription')}- </p>- <p className="text-text-secondary max-w-xl">- {t('setting.blueprintsPlaceholderSkip')}- </p>- </div>- );-}--const buildTreeFromPresets = (presets: IWikiPreset[]): WikiPresetTreeItem[] => {- const grouped = groupBy(presets, (preset) => preset.topic);-- return Object.entries(grouped).map(([topic, items]) => ({- id: topic,- name: topic,- children: items.map((preset, index) => ({- id: preset.id,- name: `${topic} ${index + 1}`,- _preset: preset,- })),- }));-};--export function BlueprintsStep({- form,- selectedTemplateIndex,- onBack,- onSave,- isLoading,-}: BlueprintsStepProps) {- const { t } = useTranslation();- const { data: presets = [] } = useFetchWikiPresets();- const [selectedItemId, setSelectedItemId] = useState<string | undefined>();-- const treeData = useMemo(() => buildTreeFromPresets(presets), [presets]);-- const instructionPath =- `templates.${selectedTemplateIndex}.config.instruction` as const;- const examplePath =- `templates.${selectedTemplateIndex}.config.example` as const;- const useBlueprintPath =- `templates.${selectedTemplateIndex}.config.use_blueprint` as const;-- const example = useWatch({- control: form.control,- name: examplePath,- });-- const instruction = useWatch({- control: form.control,- name: instructionPath,- });-- const useBlueprint = useWatch({- control: form.control,- name: useBlueprintPath,- });-- const selectedTemplateName = useMemo(() => {- if (!selectedItemId) return '';- const selectedItem = treeData- .flatMap((node) => node.children ?? [])- .find((child) => child.id === selectedItemId);- return selectedItem?.name ?? '';- }, [treeData, selectedItemId]);-- const hasTemplateData = Boolean(selectedItemId || instruction || example);-- const handleSelect = useCallback(- (item?: TreeDataItem) => {- if (!item || item.children) return;- const presetItem = item as WikiPresetTreeItem;- const preset = presetItem._preset;- if (!preset) return;-- setSelectedItemId(item.id);- form.setValue(instructionPath, preset.instruction, {- shouldValidate: false,- });- form.setValue(examplePath, preset.example, {- shouldValidate: false,- });- },- [form, instructionPath, examplePath],- );-- const handleToggleBlueprint = useCallback(- (checked: boolean | 'indeterminate') => {- if (checked === 'indeterminate') return;- form.setValue(useBlueprintPath, checked, { shouldValidate: false });- },- [form, useBlueprintPath],- );-- const handleExampleChange = useCallback(- (value: string) => {- form.setValue(examplePath, value, { shouldValidate: false });- },- [form, examplePath],- );-- return (- <section className="flex-1 flex flex-col min-h-0">- <div className="flex-1 min-h-0 flex">- <div className="w-72 shrink-0 border-r border-border-button overflow-y-auto">- <div className="text-text-secondary text-base px-5 pb-3 pt-10">- {t('setting.blueprints')}- </div>- <TreeView- data={treeData}- initialSelectedItemId={selectedItemId}- onSelectChange={handleSelect}- expandAll- />- </div>-- <div className="flex-1 min-h-0 flex flex-col">- {hasTemplateData && (- <section className="flex justify-between p-5">- <span>{selectedTemplateName}</span>- <div className="space-x-2">- <Checkbox- id="use-blueprint-checkbox"- checked={Boolean(useBlueprint)}- onCheckedChange={handleToggleBlueprint}- />- <span>{t('setting.useBlueprint')}</span>- </div>- </section>- )}- {hasTemplateData ? (- <div className="flex-1 min-h-0 flex flex-col p-5 gap-4 overflow-y-auto">- <RAGFlowFormItem- name={instructionPath}- label={t('setting.instruction')}- >- <Textarea rows={6} />- </RAGFlowFormItem>-- <RAGFlowFormItem- name={examplePath}- label={t('setting.example')}- className="flex-1 min-h-0"- >- <MarkdownEditor- content={String(example ?? '')}- onChange={handleExampleChange}- />- </RAGFlowFormItem>- </div>- ) : (- <BlueprintsEmptyState />- )}-- <footer className="shrink-0 px-5 py-4 border-t border-border-button flex items-center justify-end gap-5">- <Button type="button" variant="outline" onClick={onBack}>- {t('common.back')}- </Button>- <Button- type="button"- onClick={onSave}- loading={isLoading}- disabled={isLoading}- >- {t('common.save')}- </Button>- </footer>- </div>- </div>- </section>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/field-card.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/field-card.tsxdeleted file mode 100644index e6a4216329..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/field-card.tsx+++ /dev/null@@ -1,86 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { Button } from '@/components/ui/button';-import { Card, CardContent } from '@/components/ui/card';-import { Pencil, Trash2 } from 'lucide-react';-import { useCallback } from 'react';--type FieldCardProps = {- index: number;- title?: string;- description?: string;- onEdit: (index: number) => void;- onDelete: (index: number) => void;-};--export function FieldCard({- index,- title,- description,- onEdit,- onDelete,-}: FieldCardProps) {- const handleEdit = useCallback(() => {- onEdit(index);- }, [onEdit, index]);-- const handleDelete = useCallback(() => {- onDelete(index);- }, [onDelete, index]);-- return (- <Card className="border-border-button bg-transparent group">- <CardContent className="p-4 space-y-3">- <div className="flex items-start justify-between gap-2">- <div className="space-y-2 space-x-2 flex-1 min-w-0">- {title && (- <span className="line-clamp-1 text-sm font-medium text-text-primary">- {title}- </span>- )}- </div>- <div className="flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0">- <Button- type="button"- variant="ghost"- size="icon-xs"- onClick={handleEdit}- className="text-text-secondary hover:text-text-primary"- >- <Pencil className="size-4" />- </Button>- <Button- type="button"- variant="ghost"- size="icon-xs"- onClick={handleDelete}- className="text-text-secondary hover:text-state-error"- >- <Trash2 className="size-4" />- </Button>- </div>- </div>-- {description && (- <p className="text-sm text-text-secondary line-clamp-3">- {description}- </p>- )}- </CardContent>- </Card>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/json-preview-sheet.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/json-preview-sheet.tsxdeleted file mode 100644index 7903334984..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/json-preview-sheet.tsx+++ /dev/null@@ -1,78 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { useTranslation } from 'react-i18next';--import JsonEditor from '@/components/json-edit';-import { Button } from '@/components/ui/button';-import {- Sheet,- SheetContent,- SheetHeader,- SheetTitle,- SheetTrigger,-} from '@/components/ui/sheet';-import {- Tooltip,- TooltipContent,- TooltipTrigger,-} from '@/components/ui/tooltip';-import { Braces } from 'lucide-react';--interface JsonPreviewSheetProps {- open: boolean;- onOpenChange: (open: boolean) => void;- value: Record<string, unknown>;-}--export function JsonPreviewSheet({- open,- onOpenChange,- value,-}: JsonPreviewSheetProps) {- const { t } = useTranslation();-- return (- <Sheet open={open} onOpenChange={onOpenChange} modal={false}>- <Tooltip>- <TooltipTrigger asChild>- <SheetTrigger asChild>- <Button variant="ghost" size="icon" className="size-8">- <Braces className="size-4" />- </Button>- </SheetTrigger>- </TooltipTrigger>- <TooltipContent>{t('setting.jsonPreview')}</TooltipContent>- </Tooltip>- <SheetContent- className="w-1/2 max-w-[700px] flex flex-col"- onInteractOutside={(e) => e.preventDefault()}- >- <SheetHeader>- <SheetTitle>{t('setting.jsonPreview')}</SheetTitle>- </SheetHeader>- <div className="flex-1 min-h-0 mt-4">- <JsonEditor- value={value}- height="100%"- options={{ mode: 'tree', modes: ['tree', 'code'] }}- defaultExpanded- />- </div>- </SheetContent>- </Sheet>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/section-field-grid.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/section-field-grid.tsxdeleted file mode 100644index a329a896a9..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/section-field-grid.tsx+++ /dev/null@@ -1,92 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { Card, CardContent } from '@/components/ui/card';-import { cn } from '@/lib/utils';-import { Plus } from 'lucide-react';-import { useFieldArray, useFormContext, useWatch } from 'react-hook-form';-import { useTranslation } from 'react-i18next';--import { SectionCardFieldMap } from '../constant';-import { FieldCard } from './field-card';--type SectionFieldGridProps = {- fieldsPath: string;- sectionName: string;- onOpenAddField: () => void;- onEditField: (index: number) => void;-};--export function SectionFieldGrid({- fieldsPath,- sectionName,- onOpenAddField,- onEditField,-}: SectionFieldGridProps) {- const { t } = useTranslation();- const form = useFormContext();- const { fields, remove } = useFieldArray({- control: form.control,- name: fieldsPath,- });-- const cardFields = SectionCardFieldMap[sectionName];-- const currentFields = useWatch({- control: form.control,- name: fieldsPath,- }) as Record<string, string>[] | undefined;-- return (- <section className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4">- {fields.map((field, index) => {- const fieldValue = currentFields?.[index] ?? {};- return (- <FieldCard- key={field.id}- index={index}- title={cardFields ? fieldValue[cardFields.title] : undefined}- description={- cardFields ? fieldValue[cardFields.description] : undefined- }- onEdit={onEditField}- onDelete={remove}- />- );- })}-- <Card- role="button"- tabIndex={0}- onClick={onOpenAddField}- onKeyDown={(e) => {- if (e.key === 'Enter' || e.key === ' ') {- onOpenAddField();- }- }}- className={cn(- 'border-border-button bg-transparent border-dashed flex flex-col items-center justify-center gap-2 min-h-[140px] cursor-pointer',- 'hover:border-border-accent hover:text-text-primary text-text-secondary',- )}- >- <CardContent className="flex flex-col items-center justify-center gap-2 p-4">- <Plus className="size-6" />- <span className="text-sm font-medium">{t('setting.addField')}</span>- </CardContent>- </Card>- </section>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/template-configuration.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/template-configuration.tsxdeleted file mode 100644index 3e702e5f39..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/template-configuration.tsx+++ /dev/null@@ -1,322 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { ModelTreeSelectFormField } from '@/components/model-tree-select';-import { SelectWithSearch } from '@/components/originui/select-with-search';-import { RAGFlowFormItem } from '@/components/ragflow-form';-import { SwitchFormField } from '@/components/switch-fom-field';-import { Button } from '@/components/ui/button';-import { Input } from '@/components/ui/input';-import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';-import { Textarea } from '@/components/ui/textarea';-import { ICompilationTemplateBuiltin } from '@/interfaces/database/compilation-template';-import { startCase } from 'lodash';-import { useCallback } from 'react';-import { UseFormReturn, useWatch } from 'react-hook-form';-import { useTranslation } from 'react-i18next';--import { CompilationTemplateKind } from '@/constants/compilation';-import { TreeTemplateFields } from '@/pages/user-setting/compilation-templates/create-next/components/tree-template-fields';-import { useTemplateKindChange } from '@/pages/user-setting/compilation-templates/create-next/hooks/use-template-kind-change';-import { FormSchemaType } from '@/pages/user-setting/compilation-templates/create-next/schema';-import { SectionTitleKeyMap } from '@/pages/user-setting/compilation-templates/create-next/constant';--import { useActiveSectionTab } from '../hooks/use-active-section-tab';-import { useAvailableKindOptions } from '../hooks/use-available-kind-options';-import { useBuiltinTemplate } from '../hooks/use-builtin-template';-import { useFieldArrayHandlers } from '../hooks/use-field-array-handlers';-import { useFieldModal } from '../hooks/use-field-modal';-import { useTemplatePreviewSheets } from '../hooks/use-template-preview-sheets';-import { useTemplateSectionData } from '../hooks/use-template-section-data';--import { AddFieldModal } from './add-field-modal';-import { SectionFieldGrid } from './section-field-grid';-import { TemplatePreviewHeader } from './template-preview-header';--type TemplateConfigurationProps = {- form: UseFormReturn<FormSchemaType>;- builtins: ICompilationTemplateBuiltin[];- kindOptions: { label: string; value: string }[];- selectedTemplateIndex: number;- onNext: () => void;- onBack: () => void;- isArtifacts?: boolean;- isLoading?: boolean;-};--export function TemplateConfiguration({- form,- builtins,- kindOptions,- selectedTemplateIndex,- onNext,- onBack,- isArtifacts = false,- isLoading = false,-}: TemplateConfigurationProps) {- const { t } = useTranslation();-- const {- addFieldModalOpen,- editingFieldIndex,- setEditingFieldIndex,- handleModalOpenChange,- handleOpenAddField,- handleOpenEditField,- } = useFieldModal();-- const kind = useWatch({- control: form.control,- name: `templates.${selectedTemplateIndex}.kind`,- });- const rechunk = useWatch({- control: form.control,- name: `templates.${selectedTemplateIndex}.config.rechunk`,- });-- const availableKindOptions = useAvailableKindOptions(- form,- kindOptions,- selectedTemplateIndex,- );-- const { builtinTemplate, sectionNames } = useBuiltinTemplate(builtins, kind);-- const {- jsonSheetOpen,- setJsonSheetOpen,- workflowSheetOpen,- setWorkflowSheetOpen,- allFormValues,- templateName,- } = useTemplatePreviewSheets(form, selectedTemplateIndex);-- const { activeSectionTab, setActiveSectionTab } =- useActiveSectionTab(sectionNames);-- const handleKindChange = useTemplateKindChange({- form,- index: selectedTemplateIndex,- builtins,- });-- const { activeFieldsPath, builtinSection, existingFields, editingField } =- useTemplateSectionData(- form,- selectedTemplateIndex,- activeSectionTab,- builtinTemplate,- editingFieldIndex,- );-- const { handleAddField } = useFieldArrayHandlers(- form,- activeFieldsPath,- editingFieldIndex,- setEditingFieldIndex,- );-- const renderSectionTabs = useCallback(- (sectionName: string) => {- return (- sectionName === activeSectionTab && (- <SectionFieldGrid- key={`${activeFieldsPath}-${kind}`}- fieldsPath={activeFieldsPath}- sectionName={sectionName}- onOpenAddField={handleOpenAddField}- onEditField={handleOpenEditField}- />- )- );- },- [- activeFieldsPath,- activeSectionTab,- kind,- handleOpenAddField,- handleOpenEditField,- ],- );-- return (- <>- <TemplatePreviewHeader- templateName={templateName}- jsonSheetOpen={jsonSheetOpen}- onJsonSheetOpenChange={setJsonSheetOpen}- workflowSheetOpen={workflowSheetOpen}- onWorkflowSheetOpenChange={setWorkflowSheetOpen}- allFormValues={allFormValues}- />- <div className="flex-1 min-h-0 overflow-y-auto p-5">- <div className="max-w-4xl mx-auto space-y-6">- <RAGFlowFormItem- name={`templates.${selectedTemplateIndex}.name`}- label={t('setting.templateName')}- required- >- <Input placeholder={t('common.namePlaceholder')} />- </RAGFlowFormItem>-- <RAGFlowFormItem- name={`templates.${selectedTemplateIndex}.description`}- label={t('setting.templateDescription')}- >- <Textarea- placeholder={t('common.descriptionPlaceholder')}- rows={2}- resize="vertical"- />- </RAGFlowFormItem>-- <ModelTreeSelectFormField- name={`templates.${selectedTemplateIndex}.llm_id`}- label={t('setting.llmForExtraction')}- required- />-- <RAGFlowFormItem- name={`templates.${selectedTemplateIndex}.kind`}- label={t('knowledgeCompilation.builtinTemplates')}- required- >- {(field) => (- <SelectWithSearch- value={field.value}- onChange={(value) => handleKindChange(field, value)}- disabled={field.disabled}- options={availableKindOptions}- placeholder={t('common.selectPlaceholder')}- />- )}- </RAGFlowFormItem>-- <RAGFlowFormItem- name={`templates.${selectedTemplateIndex}.config.global_rules`}- label={t('setting.globalRules')}- >- <Textarea- placeholder={t('setting.globalRulesPlaceholder')}- rows={8}- resize="vertical"- />- </RAGFlowFormItem>-- {isArtifacts && (- <RAGFlowFormItem- name={`templates.${selectedTemplateIndex}.config.mode`}- label={t('setting.wikiMode')}- tooltip={t('setting.wikiModeTip')}- >- {(field) => (- <SelectWithSearch- value={typeof field.value === 'string' ? field.value : ''}- onChange={field.onChange}- disabled={field.disabled}- options={[- { label: t('setting.entityMode'), value: 'entity' },- { label: t('setting.topicMode'), value: 'topic' },- ]}- />- )}- </RAGFlowFormItem>- )}-- {kind === CompilationTemplateKind.Tree ? (- <TreeTemplateFields index={selectedTemplateIndex} />- ) : (- <>- {kind !== CompilationTemplateKind.Artifacts && (- <>- <SwitchFormField- name={`templates.${selectedTemplateIndex}.config.rechunk`}- label={t('setting.rechunkInput')}- tooltip={t('setting.rechunkInputTip')}- vertical={false}- />- {rechunk && (- <RAGFlowFormItem- name={`templates.${selectedTemplateIndex}.config.rechunk_rules`}- label={t('setting.rechunkRules')}- >- <Textarea- placeholder={t('setting.rechunkRulesPlaceholder')}- rows={6}- resize="vertical"- />- </RAGFlowFormItem>- )}- </>- )}- {sectionNames.length > 0 && activeSectionTab && (- <Tabs- value={activeSectionTab}- onValueChange={setActiveSectionTab}- className="w-full"- >- <TabsList className="w-full justify-start">- {sectionNames.map((sectionName) => (- <TabsTrigger- key={sectionName}- value={sectionName}- className="flex-1"- >- {t(- SectionTitleKeyMap[sectionName] ??- startCase(sectionName),- )}- </TabsTrigger>- ))}- </TabsList>-- {sectionNames.map((sectionName) => (- <TabsContent- key={sectionName}- value={sectionName}- className="mt-4"- >- {renderSectionTabs(sectionName)}- </TabsContent>- ))}- </Tabs>- )}- </>- )}- </div>- </div>-- <footer className="shrink-0 px-5 py-4 border-t border-border-button flex items-center justify-end gap-5">- <Button type="button" variant="outline" onClick={onBack}>- {t('common.back')}- </Button>- <Button type="button" loading={isLoading} onClick={onNext}>- {isArtifacts ? t('common.next') : t('common.save')}- </Button>- </footer>-- <AddFieldModal- open={addFieldModalOpen}- onOpenChange={handleModalOpenChange}- sectionName={activeSectionTab}- builtinSection={builtinSection}- existingFields={existingFields}- initialField={editingField}- onAdd={handleAddField}- />- </>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/template-preview-header.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/template-preview-header.tsxdeleted file mode 100644index 46c05eac0a..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/template-preview-header.tsx+++ /dev/null@@ -1,52 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { useTranslation } from 'react-i18next';--import { JsonPreviewSheet } from './json-preview-sheet';--interface TemplatePreviewHeaderProps {- templateName: string | undefined;- jsonSheetOpen: boolean;- onJsonSheetOpenChange: (open: boolean) => void;- workflowSheetOpen: boolean;- onWorkflowSheetOpenChange: (open: boolean) => void;- allFormValues: Record<string, unknown>;-}--export function TemplatePreviewHeader({- templateName,- jsonSheetOpen,- onJsonSheetOpenChange,- allFormValues,-}: TemplatePreviewHeaderProps) {- const { t } = useTranslation();-- return (- <section className="shrink-0 flex justify-between items-center px-5 py-4 border-b border-border-button">- <span className="text-lg font-medium text-text-primary">- {templateName || t('setting.templateName')}- </span>- <div className="flex items-center gap-2">- <JsonPreviewSheet- open={jsonSheetOpen}- onOpenChange={onJsonSheetOpenChange}- value={allFormValues}- />- </div>- </section>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/template-sidebar.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/template-sidebar.tsxdeleted file mode 100644index 937674d164..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/template-sidebar.tsx+++ /dev/null@@ -1,201 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { Button } from '@/components/ui/button';-import { cn } from '@/lib/utils';-import { Plus, Trash2 } from 'lucide-react';-import { useCallback, type KeyboardEvent, type MouseEvent } from 'react';-import {- FieldArrayWithId,- UseFieldArrayReturn,- UseFormReturn,-} from 'react-hook-form';-import { useTranslation } from 'react-i18next';--import { formatKindLabel } from '@/utils/compilation-template-util';--import { DefaultTemplateValues } from '@/pages/user-setting/compilation-templates/create-next/constant';-import { FormSchemaType } from '@/pages/user-setting/compilation-templates/create-next/schema';-import { generateTemplateName } from '@/pages/user-setting/compilation-templates/create-next/utils';--import { useTemplateAddButton } from '../hooks/use-template-add-button';--type TemplateSidebarProps = {- form: UseFormReturn<FormSchemaType>;- fields: FieldArrayWithId<FormSchemaType, 'templates'>[];- append: UseFieldArrayReturn<FormSchemaType, 'templates'>['append'];- remove: UseFieldArrayReturn<FormSchemaType, 'templates'>['remove'];- kindOptions: { label: string; value: string }[];- selectedTemplateIndex: number;- onSelectTemplate: (index: number) => void;-};--type TemplateSidebarItemProps = {- field: FieldArrayWithId<FormSchemaType, 'templates'>;- index: number;- template: FormSchemaType['templates'][number] | undefined;- isActive: boolean;- canRemove: boolean;- onSelectTemplate: (index: number) => void;- onRemoveTemplate: (index: number) => void;-};--function TemplateSidebarItem({- field,- index,- template,- isActive,- canRemove,- onSelectTemplate,- onRemoveTemplate,-}: TemplateSidebarItemProps) {- const { t } = useTranslation();-- const handleClick = useCallback(() => {- onSelectTemplate(index);- }, [index, onSelectTemplate]);-- const handleKeyDown = useCallback(- (e: KeyboardEvent<HTMLDivElement>) => {- if (e.key === 'Enter' || e.key === ' ') {- onSelectTemplate(index);- }- },- [index, onSelectTemplate],- );-- const handleRemoveClick = useCallback(- (e: MouseEvent<HTMLButtonElement>) => {- e.stopPropagation();- onRemoveTemplate(index);- },- [index, onRemoveTemplate],- );-- return (- <div- key={field.id}- role="button"- tabIndex={0}- onClick={handleClick}- onKeyDown={handleKeyDown}- className={cn(- 'group flex items-center justify-between px-3 py-2 rounded-md text-sm cursor-pointer',- isActive- ? 'bg-bg-card text-text-primary'- : 'text-text-secondary hover:bg-bg-card hover:text-text-primary',- )}- >- <div className="flex items-center min-w-0 flex-1">- <span className="truncate">- {template?.name || `${t('setting.template')} #${index + 1}`}- </span>- {template?.kind && (- <span className="ml-2 shrink-0 text-text-secondary">- {formatKindLabel(t, template.kind)}- </span>- )}- </div>-- {canRemove && (- <Button- type="button"- variant="ghost"- size="icon-xs"- onClick={handleRemoveClick}- className="opacity-0 group-hover:opacity-100 focus:opacity-100 text-text-secondary hover:text-state-error"- >- <Trash2 className="size-4" />- </Button>- )}- </div>- );-}--export function TemplateSidebar({- form,- fields,- append,- remove,- kindOptions,- selectedTemplateIndex,- onSelectTemplate,-}: TemplateSidebarProps) {- const { t } = useTranslation();- const { templates, isAddButtonHidden } = useTemplateAddButton(- form,- kindOptions,- );-- const handleAddTemplate = useCallback(() => {- const firstTemplateLlmId = form.getValues('templates.0.llm_id');- const nextIndex = fields.length;- append({- ...DefaultTemplateValues,- name: generateTemplateName(),- llm_id: firstTemplateLlmId || '',- });- onSelectTemplate(nextIndex);- }, [append, fields.length, form, onSelectTemplate]);-- const handleRemoveTemplate = useCallback(- (index: number) => {- remove(index);- if (selectedTemplateIndex === index) {- onSelectTemplate(Math.max(0, index - 1));- } else if (selectedTemplateIndex > index) {- onSelectTemplate(selectedTemplateIndex - 1);- }- },- [onSelectTemplate, remove, selectedTemplateIndex],- );-- return (- <aside className="h-full flex flex-col">- <div className="flex items-center justify-between px-4 py-3 border-b border-border-button">- <span className="text-sm font-medium text-text-primary">- {t('setting.templates')}- </span>- {false && !isAddButtonHidden && (- <Button- type="button"- variant="ghost"- size="icon-xs"- onClick={handleAddTemplate}- className="text-text-secondary hover:text-text-primary"- >- <Plus className="size-4" />- </Button>- )}- </div>-- <div className="flex-1 overflow-y-auto p-2 space-y-1">- {fields.map((field, index) => (- <TemplateSidebarItem- key={field.id}- field={field}- index={index}- template={templates[index]}- isActive={selectedTemplateIndex === index}- canRemove={fields.length > 1}- onSelectTemplate={onSelectTemplate}- onRemoveTemplate={handleRemoveTemplate}- />- ))}- </div>- </aside>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/template-stepper.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/template-stepper.tsxdeleted file mode 100644index bb1633195b..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/template-stepper.tsx+++ /dev/null@@ -1,125 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import {- Stepper,- StepperDescription,- StepperIndicator,- StepperItem,- StepperNav,- StepperSeparator,- StepperTitle,- StepperTrigger,-} from '@/components/reui/stepper';-import { cn } from '@/lib/utils';-import { Cog, FileText, Palette } from 'lucide-react';-import { useMemo } from 'react';-import { useTranslation } from 'react-i18next';--interface TemplateStepperProps {- activeStep: number;- isArtifacts: boolean;- onStepChange: (step: number) => void;-}--export function TemplateStepper({- activeStep,- isArtifacts,- onStepChange,-}: TemplateStepperProps) {- const { t } = useTranslation();-- const steps = useMemo(- () => [- {- id: 'basic-info',- title: t('setting.basicInfo'),- description: t('setting.basicInfoDescription'),- icon: FileText,- },- {- id: 'configuration',- title: t('setting.templateWizardConfiguration'),- description: t('setting.templateWizardConfigurationDescription'),- icon: Cog,- },- ...(isArtifacts- ? [- {- id: 'blueprints',- title: t('setting.blueprints'),- description: t('setting.blueprintsDescription'),- icon: Palette,- },- ]- : []),- ],- [isArtifacts, t],- );-- return (- <Stepper- value={activeStep}- onValueChange={onStepChange}- className="flex justify-center"- >- <StepperNav className="justify-center max-w-4xl">- {steps.map((step, index) => {- const stepNumber = index + 1;- const isActive = stepNumber === activeStep;- const Icon = step.icon;- const isLast = index === steps.length - 1;-- return (- <StepperItem- key={step.id}- step={stepNumber}- className="items-start flex-1 relative"- disabled={stepNumber > activeStep}- >- <StepperTrigger type="button" className="flex flex-col gap-1">- <StepperIndicator- className={cn(- 'size-8 border !bg-bg-card !text-text-primary !border-border-button',- isActive && '!border-accent-primary !text-accent-primary',- )}- >- <Icon className="size-4" />- </StepperIndicator>- <StepperTitle- className={cn(- 'mt-2 text-center text-sm font-medium leading-none',- isActive && 'text-accent-primary',- )}- >- {step.title}- </StepperTitle>- <StepperDescription- className={'text-center text-text-secondary'}- >- {step.description}- </StepperDescription>- </StepperTrigger>- {!isLast && (- <StepperSeparator className="group-data-[state=completed]/step:bg-primary absolute inset-x-0 top-3.5 left-[calc(50%+1.4rem)] m-0 group-data-[orientation=horizontal]/stepper-nav:w-[calc(100%-3rem+0.225rem)] group-data-[orientation=horizontal]/stepper-nav:flex-none" />- )}- </StepperItem>- );- })}- </StepperNav>- </Stepper>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/tree-template-fields.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/tree-template-fields.tsxdeleted file mode 100644index 29a813ec5f..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/tree-template-fields.tsx+++ /dev/null@@ -1,78 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { Collapse } from '@/components/collapse';-import { RAGFlowFormItem } from '@/components/ragflow-form';-import { SliderInputFormField } from '@/components/slider-input-form-field';-import { SwitchFormField } from '@/components/switch-fom-field';-import { Textarea } from '@/components/ui/textarea';-import { useTranslation } from 'react-i18next';--type TreeTemplateFieldsProps = {- index: number;-};--export function TreeTemplateFields({ index }: TreeTemplateFieldsProps) {- const { t } = useTranslation();-- return (- <Collapse defaultOpen title={t('setting.raptorTreeSettings')}>- <div className="space-y-4">- <RAGFlowFormItem- name={`templates.${index}.config.raptor.prompt`}- label={t('setting.summarizationPrompt')}- >- <Textarea- placeholder={t('setting.descriptionPlaceholder')}- rows={8}- resize="vertical"- />- </RAGFlowFormItem>-- <SliderInputFormField- name={`templates.${index}.config.raptor.max_token`}- label={t('setting.maxToken')}- max={2048}- min={512}- step={1}- />- <SliderInputFormField- name={`templates.${index}.config.raptor.clustering_threshold`}- label={t('setting.clusteringThreshold')}- tooltip={t('setting.clusteringThresholdTip')}- step={0.01}- max={1}- min={0}- />- <SliderInputFormField- name={`templates.${index}.config.raptor.clustering_ratio`}- label={t('setting.clusteringRatio')}- tooltip={t('setting.clusteringRatioTip')}- step={0.01}- max={1}- min={0}- />-- <SwitchFormField- name={`templates.${index}.config.raptor.rechunk`}- label={t('setting.rechunkByTreeLeaves')}- tooltip={t('setting.rechunkByTreeLeavesTip')}- vertical={false}- />- </div>- </Collapse>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/components/workflow-preview-sheet.tsx b/web/src/pages/user-setting/compilation-templates/create-next/components/workflow-preview-sheet.tsxdeleted file mode 100644index 1e4d848973..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/components/workflow-preview-sheet.tsx+++ /dev/null@@ -1,72 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { useTranslation } from 'react-i18next';--import { Button } from '@/components/ui/button';-import {- Sheet,- SheetContent,- SheetHeader,- SheetTitle,- SheetTrigger,-} from '@/components/ui/sheet';-import {- Tooltip,- TooltipContent,- TooltipTrigger,-} from '@/components/ui/tooltip';-import { Workflow } from 'lucide-react';--interface WorkflowPreviewSheetProps {- open: boolean;- onOpenChange: (open: boolean) => void;-}--export function WorkflowPreviewSheet({- open,- onOpenChange,-}: WorkflowPreviewSheetProps) {- const { t } = useTranslation();-- return (- <Sheet open={open} onOpenChange={onOpenChange} modal={false}>- <Tooltip>- <TooltipTrigger asChild>- <SheetTrigger asChild>- <Button variant="ghost" size="icon" className="size-8">- <Workflow className="size-4" />- </Button>- </SheetTrigger>- </TooltipTrigger>- <TooltipContent>{t('setting.processFlow')}</TooltipContent>- </Tooltip>- <SheetContent- className="w-1/2 max-w-[700px] flex flex-col"- onInteractOutside={(e) => e.preventDefault()}- >- <SheetHeader>- <SheetTitle>{t('setting.processFlow')}</SheetTitle>- </SheetHeader>- <div className="flex-1 min-h-0 mt-4 flex items-center justify-center">- <span className="text-text-disabled">- {t('setting.processFlowComingSoon')}- </span>- </div>- </SheetContent>- </Sheet>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/constant.ts b/web/src/pages/user-setting/compilation-templates/create-next/constant.tsdeleted file mode 100644index 3126132618..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/constant.ts+++ /dev/null@@ -1,81 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { FormSchemaType, TemplateSchemaType } from './schema';--export const DefaultFieldKeys = ['type', 'description', 'rule'];--export const FieldKeyOrders = [- DefaultFieldKeys,- ['statement', 'subject'],- ['definition_excerpt', 'term'],-];--export const DefaultTemplateValues: TemplateSchemaType = {- id: undefined,- name: '',- description: '',- llm_id: '',- kind: '',- config: {- kind: '',- llm_id: '',- global_rules: '',- example: '',- instruction: '',- use_blueprint: false,- mode: 'entity',- rechunk: false,- rechunk_rules: '',- },-};--export const DefaultValues: FormSchemaType = {- name: '',- description: '',- avatar: '',- templates: [DefaultTemplateValues],-};--export const SectionTitleKeyMap: Record<string, string> = {- entity: 'setting.entitySpecification',- relation: 'setting.relationSpecification',- concept: 'setting.conceptSpecification',- claim: 'setting.claimSpecification',-};--export const SectionCardFieldMap: Record<- string,- { title: string; description: string }-> = {- entity: { title: 'type', description: 'description' },- relation: { title: 'type', description: 'description' },- claim: { title: 'statement', description: 'subject' },- concept: { title: 'definition_excerpt', description: 'term' },-};--export const SectionPriority = ['entity', 'relation'];--export const FieldLabelKeyMap: Record<string, string> = {- type: 'setting.fieldType',- description: 'setting.fieldDescription',- rule: 'setting.fieldRule',-};--export const FieldRequiredMessageKeyMap: Record<string, string> = {- type: 'setting.fieldTypeRequired',- description: 'setting.fieldDescriptionRequired',-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-active-section-tab.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-active-section-tab.tsdeleted file mode 100644index f25bd0b064..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-active-section-tab.ts+++ /dev/null@@ -1,29 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { useEffect, useState } from 'react';--export const useActiveSectionTab = (sectionNames: string[]) => {- const [activeSectionTab, setActiveSectionTab] = useState<string>('');-- useEffect(() => {- setActiveSectionTab((prev) =>- sectionNames.includes(prev) ? prev : (sectionNames[0] ?? ''),- );- }, [sectionNames]);-- return { activeSectionTab, setActiveSectionTab };-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-add-field-form.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-add-field-form.tsdeleted file mode 100644index 036289271f..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-add-field-form.ts+++ /dev/null@@ -1,146 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { ICompilationTemplateSection } from '@/interfaces/database/compilation-template';-import {- createEmptyField,- getAvailableTypeOptions,- getFieldKeyOrder,- getRequiredFieldKeys,-} from '@/pages/user-setting/compilation-templates/create-next/utils';-import { useCallback, useEffect, useMemo } from 'react';-import { useForm } from 'react-hook-form';--type UseAddFieldFormOptions = {- open: boolean;- builtinSection?: ICompilationTemplateSection;- existingFields?: Record<string, string>[];- initialField?: Record<string, string>;-};--export const useAddFieldForm = ({- open,- builtinSection,- existingFields,- initialField,-}: UseAddFieldFormOptions) => {- const form = useForm<Record<string, string>>({- defaultValues: {},- });-- const fieldKeys = useMemo(() => {- const firstField = builtinSection?.fields?.[0];- const keys = firstField- ? Object.keys(firstField)- : ['type', 'description', 'rule'];- return getFieldKeyOrder(keys);- }, [builtinSection]);-- const hasTypeField = fieldKeys.includes('type');-- const requiredKeys = useMemo(- () => getRequiredFieldKeys(fieldKeys),- [fieldKeys],- );-- const typeOptions = useMemo(- () =>- getAvailableTypeOptions(- builtinSection,- existingFields,- initialField?.type,- ),- [builtinSection, existingFields, initialField],- );-- const buildField = useCallback(- (typeValue: string) => {- const matched = builtinSection?.fields?.find(- (field) => field.type === typeValue,- );- if (matched) {- const normalized: Record<string, string> = {};- fieldKeys.forEach((key) => {- normalized[key] = (matched as Record<string, string>)[key] ?? '';- });- return normalized;- }- const empty = createEmptyField(fieldKeys);- if (hasTypeField) {- empty.type = typeValue;- }- return empty;- },- [builtinSection, fieldKeys, hasTypeField],- );-- useEffect(() => {- if (!open) return;-- if (initialField) {- const normalized: Record<string, string> = {};- fieldKeys.forEach((key) => {- normalized[key] = initialField[key] ?? '';- });- form.reset(normalized);- return;- }-- const firstType = typeOptions[0]?.value ?? '';- form.reset(buildField(firstType));- }, [buildField, fieldKeys, form, initialField, open, typeOptions]);-- const handleTypeChange = useCallback(- (value: string) => {- if (initialField) {- form.setValue('type', value, {- shouldDirty: true,- shouldTouch: true,- });- return;- }-- const nextField = buildField(value);- Object.entries(nextField).forEach(([key, val]) => {- form.setValue(key, val, {- shouldDirty: true,- shouldTouch: true,- });- if (val) form.clearErrors(key);- });- },- [buildField, form, initialField],- );-- const handleSubmit = useCallback(- (onAdd: (field: Record<string, string>) => void) => {- return form.handleSubmit((values) => {- onAdd(values);- });- },- [form],- );-- return {- form,- fieldKeys,- hasTypeField,- requiredKeys,- typeOptions,- handleTypeChange,- handleSubmit,- };-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-available-kind-options.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-available-kind-options.tsdeleted file mode 100644index fe58b8cb74..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-available-kind-options.ts+++ /dev/null@@ -1,69 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { CompilationTemplateKind } from '@/constants/compilation';-import { FormSchemaType } from '@/pages/user-setting/compilation-templates/create-next/schema';-import { useMemo } from 'react';-import { UseFormReturn, useWatch } from 'react-hook-form';--export const useAvailableKindOptions = (- form: UseFormReturn<FormSchemaType>,- kindOptions: { label: string; value: string }[],- selectedTemplateIndex: number,-) => {- const kind = useWatch({- control: form.control,- name: `templates.${selectedTemplateIndex}.kind`,- });-- const templates = useWatch({ control: form.control, name: 'templates' });-- const availableKindOptions = useMemo(() => {- const otherSelectedKinds = new Set(- templates- ?.filter((_, index) => index !== selectedTemplateIndex)- .map((template) => template.kind)- .filter((value): value is string => Boolean(value)) ?? [],- );-- const hasOtherNonArtifactsKind = Array.from(otherSelectedKinds).some(- (value) => value !== CompilationTemplateKind.Artifacts,- );- const hasOtherArtifactsKind = otherSelectedKinds.has(- CompilationTemplateKind.Artifacts,- );-- return kindOptions.filter((option) => {- if (option.value === kind) return true;- if (otherSelectedKinds.has(option.value)) return false;- if (- hasOtherNonArtifactsKind &&- option.value === CompilationTemplateKind.Artifacts- ) {- return false;- }- if (- hasOtherArtifactsKind &&- option.value !== CompilationTemplateKind.Artifacts- ) {- return false;- }- return true;- });- }, [kindOptions, kind, selectedTemplateIndex, templates]);-- return availableKindOptions;-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-builtin-template.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-builtin-template.tsdeleted file mode 100644index 70075f4f51..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-builtin-template.ts+++ /dev/null@@ -1,51 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { useMemo } from 'react';--import {- ICompilationTemplateBuiltin,- ICompilationTemplateSection,-} from '@/interfaces/database/compilation-template';-import {- isConfigMetaKey,- sortSectionNames,-} from '@/pages/user-setting/compilation-templates/create-next/utils';--export const useBuiltinTemplate = (- builtins: ICompilationTemplateBuiltin[],- kind: string,-) => {- const builtinTemplate = useMemo(- () => builtins.find((template) => template.kind === kind),- [builtins, kind],- );-- const sectionNames = useMemo(() => {- const names = Object.keys(builtinTemplate?.config ?? {}).filter((key) => {- if (isConfigMetaKey(key)) return false;- const section = builtinTemplate?.config?.[key];- return (- section &&- typeof section === 'object' &&- Array.isArray((section as ICompilationTemplateSection).fields)- );- });- return sortSectionNames(names);- }, [builtinTemplate]);-- return { builtinTemplate, sectionNames };-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-compilation-template-group-form.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-compilation-template-group-form.tsdeleted file mode 100644index 081cfa89d0..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-compilation-template-group-form.ts+++ /dev/null@@ -1,73 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { zodResolver } from '@hookform/resolvers/zod';-import { useEffect, useMemo } from 'react';-import { useForm } from 'react-hook-form';-import { useTranslation } from 'react-i18next';--import { ICompilationTemplateGroup } from '@/interfaces/database/compilation-template';--import { buildFormSchema, FormSchemaType } from '../schema';-import { DefaultValues } from '../constant';-import { generateTemplateName, transformGroupDetailToForm } from '../utils';--type UseCompilationTemplateGroupFormOptions = {- detail?: ICompilationTemplateGroup;- defaultLlmId?: string;- isCreate: boolean;-};--export const useCompilationTemplateGroupForm = ({- detail,- defaultLlmId,- isCreate,-}: UseCompilationTemplateGroupFormOptions) => {- const { t } = useTranslation();-- const defaultValues = useMemo<FormSchemaType>(() => {- if (!isCreate) return DefaultValues;- return {- ...DefaultValues,- templates: [- {- ...DefaultValues.templates[0],- name: generateTemplateName(),- },- ],- };- }, [isCreate]);-- const form = useForm<FormSchemaType>({- resolver: zodResolver(buildFormSchema(t)),- defaultValues,- mode: 'onChange',- });-- useEffect(() => {- if (detail) {- form.reset(transformGroupDetailToForm(detail));- } else if (- isCreate &&- defaultLlmId &&- !form.getValues('templates.0.llm_id')- ) {- form.setValue('templates.0.llm_id', defaultLlmId);- }- }, [defaultLlmId, detail, form, isCreate]);-- return { form };-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-compilation-template-group-submit.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-compilation-template-group-submit.tsdeleted file mode 100644index 7c055b6cd3..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-compilation-template-group-submit.ts+++ /dev/null@@ -1,64 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { useCallback } from 'react';--import {- ICreateCompilationTemplateGroupRequestBody,- IUpdateCompilationTemplateGroupRequestBody,-} from '@/interfaces/request/compilation-template';--import { FormSchemaType } from '../schema';-import { transformFormToPayload } from '../utils';--type UseCompilationTemplateGroupSubmitOptions = {- isCreate: boolean;- id?: string;- createGroup: (- params: ICreateCompilationTemplateGroupRequestBody,- ) => Promise<{ code: number } & Record<string, unknown>>;- updateGroup: (- id: string,- params: IUpdateCompilationTemplateGroupRequestBody,- ) => Promise<{ code: number } & Record<string, unknown>>;- onSuccess: () => void;-};--export const useCompilationTemplateGroupSubmit = ({- isCreate,- id,- createGroup,- updateGroup,- onSuccess,-}: UseCompilationTemplateGroupSubmitOptions) => {- const onSubmit = useCallback(- async (values: FormSchemaType) => {- const payload = transformFormToPayload(values);- let result;- if (isCreate) {- result = await createGroup(payload);- } else if (id) {- result = await updateGroup(id, payload);- }- if (result?.code === 0) {- onSuccess();- }- },- [createGroup, id, isCreate, onSuccess, updateGroup],- );-- return { onSubmit };-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-create-next-compilation-template-group.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-create-next-compilation-template-group.tsdeleted file mode 100644index 93bff3d482..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-create-next-compilation-template-group.ts+++ /dev/null@@ -1,85 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';-import {- useCreateCompilationTemplateGroup,- useFetchCompilationTemplateGroup,- useUpdateCompilationTemplateGroup,-} from '@/hooks/use-compilation-template-group-request';-import { useFetchBuiltinCompilationTemplates } from '@/hooks/use-compilation-template-request';-import { useFetchDefaultModelDictionary } from '@/hooks/use-llm-request';-import { isCreateCompilationTemplateGroup } from '@/utils/compilation-template-util';-import { useMemo } from 'react';-import { useTranslation } from 'react-i18next';-import { useParams } from 'react-router';--import { formatKindLabel } from '@/utils/compilation-template-util';--import { useCompilationTemplateGroupForm } from '@/pages/user-setting/compilation-templates/create-next/hooks/use-compilation-template-group-form';-import { useCompilationTemplateGroupSubmit } from '@/pages/user-setting/compilation-templates/create-next/hooks/use-compilation-template-group-submit';--export const useCreateNextCompilationTemplateGroup = () => {- const { id } = useParams<{ id: string }>();- const { navigateToCompilationTemplates } = useNavigatePage();- const { t } = useTranslation();-- const isCreate = isCreateCompilationTemplateGroup(id);-- const { data: detail } = useFetchCompilationTemplateGroup();- const { data: builtins, kindOptions: builtinKindOptions } =- useFetchBuiltinCompilationTemplates();- const defaultModelDictionary = useFetchDefaultModelDictionary();-- const { createGroup, loading: createLoading } =- useCreateCompilationTemplateGroup();- const { updateGroup, loading: updateLoading } =- useUpdateCompilationTemplateGroup();-- const kindOptions = useMemo(- () =>- builtinKindOptions.map((option) => ({- ...option,- label: formatKindLabel(t, option.value),- })),- [builtinKindOptions, t],- );-- const { form } = useCompilationTemplateGroupForm({- detail,- defaultLlmId: defaultModelDictionary.llm_id,- isCreate,- });-- const { onSubmit } = useCompilationTemplateGroupSubmit({- isCreate,- id,- createGroup,- updateGroup,- onSuccess: navigateToCompilationTemplates,- });-- return {- id,- form,- kindOptions,- builtins,- onSubmit,- isCreate,- isLoading: isCreate ? createLoading : updateLoading,- navigateToCompilationTemplates,- };-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-field-array-handlers.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-field-array-handlers.tsdeleted file mode 100644index b8c49bf03b..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-field-array-handlers.ts+++ /dev/null@@ -1,55 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { useCallback } from 'react';-import { ArrayPath, UseFormReturn } from 'react-hook-form';--import { FormSchemaType } from '@/pages/user-setting/compilation-templates/create-next/schema';--export const useFieldArrayHandlers = (- form: UseFormReturn<FormSchemaType>,- activeFieldsPath: ArrayPath<FormSchemaType>,- editingFieldIndex: number | null,- setEditingFieldIndex: (index: number | null) => void,-) => {- const handleAddField = useCallback(- (field: Record<string, string>) => {- const currentFields =- (form.getValues(activeFieldsPath) as- | Record<string, string>[]- | undefined) ?? [];- if (editingFieldIndex !== null) {- const newFields = [...currentFields];- newFields[editingFieldIndex] = field;- form.setValue(activeFieldsPath, newFields, {- shouldValidate: false,- shouldDirty: true,- shouldTouch: true,- });- } else {- form.setValue(activeFieldsPath, [...currentFields, field], {- shouldValidate: false,- shouldDirty: true,- shouldTouch: true,- });- }- setEditingFieldIndex(null);- },- [activeFieldsPath, editingFieldIndex, form, setEditingFieldIndex],- );-- return { handleAddField };-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-field-modal.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-field-modal.tsdeleted file mode 100644index 6a35082f68..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-field-modal.ts+++ /dev/null@@ -1,51 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { useCallback, useState } from 'react';--export const useFieldModal = () => {- const [addFieldModalOpen, setAddFieldModalOpen] = useState(false);- const [editingFieldIndex, setEditingFieldIndex] = useState<number | null>(- null,- );-- const handleModalOpenChange = useCallback(- (open: boolean) => {- setAddFieldModalOpen(open);- if (!open) setEditingFieldIndex(null);- },- [setAddFieldModalOpen],- );-- const handleOpenAddField = useCallback(() => {- setEditingFieldIndex(null);- setAddFieldModalOpen(true);- }, []);-- const handleOpenEditField = useCallback((index: number) => {- setEditingFieldIndex(index);- setAddFieldModalOpen(true);- }, []);-- return {- addFieldModalOpen,- editingFieldIndex,- setEditingFieldIndex,- handleModalOpenChange,- handleOpenAddField,- handleOpenEditField,- };-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-add-button.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-add-button.tsdeleted file mode 100644index 7b34954a8d..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-add-button.ts+++ /dev/null@@ -1,45 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { CompilationTemplateKind } from '@/constants/compilation';-import { FormSchemaType } from '@/pages/user-setting/compilation-templates/create-next/schema';-import { UseFormReturn, useWatch } from 'react-hook-form';--export const useTemplateAddButton = (- form: UseFormReturn<FormSchemaType>,- kindOptions: { label: string; value: string }[],-) => {- const templates =- useWatch({ control: form.control, name: 'templates' }) ?? [];-- const hasTemplateWithoutKind = templates.some((template) => !template.kind);- const hasArtifactsTemplate = templates.some(- (template) => template.kind === CompilationTemplateKind.Artifacts,- );- const selectedKinds = new Set(- templates- .map((template) => template.kind)- .filter((kind): kind is string => Boolean(kind)),- );- const allKindsSelected =- kindOptions.length > 0 &&- kindOptions.every((option) => selectedKinds.has(option.value));-- const isAddButtonHidden =- hasTemplateWithoutKind || hasArtifactsTemplate || allKindsSelected;-- return { templates, isAddButtonHidden };-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-kind-change.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-kind-change.tsdeleted file mode 100644index 3ae6776195..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-kind-change.ts+++ /dev/null@@ -1,58 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { ICompilationTemplateBuiltin } from '@/interfaces/database/compilation-template';-import { UseFormReturn } from 'react-hook-form';--import { FormSchemaType } from '../schema';-import { buildConfigFromBuiltin } from '../utils';--type FieldLike = {- value: string;- onChange: (value: string) => void;-};--type UseTemplateKindChangeOptions = {- form: UseFormReturn<FormSchemaType>;- index: number;- builtins: ICompilationTemplateBuiltin[];-};--export const useTemplateKindChange = ({- form,- index,- builtins,-}: UseTemplateKindChangeOptions) => {- return (field: FieldLike, value: string) => {- if (value && value !== field.value) {- const builtinTemplate = builtins.find(- (template) => template.kind === value,- );- if (builtinTemplate) {- form.setValue(- `templates.${index}.config`,- buildConfigFromBuiltin(- builtinTemplate,- value,- form.getValues(`templates.${index}.llm_id`),- ),- { shouldValidate: false },- );- }- }- field.onChange(value);- };-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-preview-sheets.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-preview-sheets.tsdeleted file mode 100644index 229d72cb50..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-preview-sheets.ts+++ /dev/null@@ -1,44 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { useState } from 'react';-import { UseFormReturn, useWatch } from 'react-hook-form';--import { FormSchemaType } from '@/pages/user-setting/compilation-templates/create-next/schema';--export function useTemplatePreviewSheets(- form: UseFormReturn<FormSchemaType>,- selectedTemplateIndex: number,-) {- const [jsonSheetOpen, setJsonSheetOpen] = useState(false);- const [workflowSheetOpen, setWorkflowSheetOpen] = useState(false);-- const allFormValues = useWatch({ control: form.control });-- const templateName = useWatch({- control: form.control,- name: `templates.${selectedTemplateIndex}.name`,- });-- return {- jsonSheetOpen,- setJsonSheetOpen,- workflowSheetOpen,- setWorkflowSheetOpen,- allFormValues,- templateName,- };-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-section-data.ts b/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-section-data.tsdeleted file mode 100644index 3b965b0dc1..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/hooks/use-template-section-data.ts+++ /dev/null@@ -1,62 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { useMemo } from 'react';-import { ArrayPath, UseFormReturn, useWatch } from 'react-hook-form';--import {- ICompilationTemplateBuiltin,- ICompilationTemplateSection,-} from '@/interfaces/database/compilation-template';-import { FormSchemaType } from '@/pages/user-setting/compilation-templates/create-next/schema';--export const useTemplateSectionData = (- form: UseFormReturn<FormSchemaType>,- selectedTemplateIndex: number,- activeSectionTab: string,- builtinTemplate: ICompilationTemplateBuiltin | undefined,- editingFieldIndex: number | null,-) => {- const activeSectionPath = `templates.${selectedTemplateIndex}.config.${activeSectionTab}`;- const activeFieldsPath =- `${activeSectionPath}.fields` as ArrayPath<FormSchemaType>;-- const builtinSection = useMemo(() => {- return builtinTemplate?.config?.[activeSectionTab] as- | ICompilationTemplateSection- | undefined;- }, [activeSectionTab, builtinTemplate?.config]);-- const existingFields = useWatch({- control: form.control,- name: activeFieldsPath,- }) as Record<string, string>[] | undefined;-- const editingField = useMemo(() => {- if (editingFieldIndex === null) return undefined;- return ((form.getValues(activeFieldsPath) as- | Record<string, string>[]- | undefined) ?? [])[editingFieldIndex];- }, [activeFieldsPath, editingFieldIndex, form]);-- return {- activeSectionPath,- activeFieldsPath,- builtinSection,- existingFields,- editingField,- };-};diff --git a/web/src/pages/user-setting/compilation-templates/create-next/index.tsx b/web/src/pages/user-setting/compilation-templates/create-next/index.tsxdeleted file mode 100644index e06c53938e..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/index.tsx+++ /dev/null@@ -1,167 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import BackButton from '@/components/back-button';-import { Button } from '@/components/ui/button';-import { Form } from '@/components/ui/form';-import {- ResizableHandle,- ResizablePanel,- ResizablePanelGroup,-} from '@/components/ui/resizable';-import { CompilationTemplateKind } from '@/constants/compilation';-import { Routes } from '@/routes';-import { useCallback, useState } from 'react';-import { useFieldArray, useWatch } from 'react-hook-form';-import { useTranslation } from 'react-i18next';--import { useFetchCompilationTemplateGroup } from '@/hooks/use-compilation-template-group-request';-import { BasicInfoStep } from './components/basic-info-step';-import { BlueprintsStep } from './components/blueprints-step';-import { TemplateConfiguration } from './components/template-configuration';-import { TemplateSidebar } from './components/template-sidebar';-import { TemplateStepper } from './components/template-stepper';-import { useCreateNextCompilationTemplateGroup } from './hooks/use-create-next-compilation-template-group';--export default function CreateNextCompilationTemplate() {- const { t } = useTranslation();- const [activeStep, setActiveStep] = useState(1);- const [selectedTemplateIndex, setSelectedTemplateIndex] = useState(0);-- const { form, kindOptions, builtins, onSubmit, isCreate, isLoading } =- useCreateNextCompilationTemplateGroup();- const { data: group } = useFetchCompilationTemplateGroup();-- const { fields, append, remove } = useFieldArray({- control: form.control,- name: 'templates',- });-- const selectedKind = useWatch({- control: form.control,- name: `templates.${selectedTemplateIndex}.kind`,- });-- const isArtifacts = selectedKind === CompilationTemplateKind.Artifacts;-- const handleStepChange = useCallback(- (step: number) => {- // Allow clicking back to completed steps only.- if (step < activeStep) {- setActiveStep(step);- }- },- [activeStep],- );-- const handleNext = useCallback(async () => {- if (activeStep === 1) {- const valid = await form.trigger(['name', 'description']);- if (valid) setActiveStep(2);- } else if (activeStep === 2) {- const valid = await form.trigger(`templates.${selectedTemplateIndex}`);- if (!valid) return;- if (isArtifacts) {- setActiveStep(3);- } else {- form.handleSubmit(onSubmit)();- }- }- }, [activeStep, form, isArtifacts, onSubmit, selectedTemplateIndex]);-- const handleBack = useCallback(() => {- setActiveStep(1);- }, []);-- return (- <section className="h-full flex flex-col bg-bg-base">- <header className="shrink-0 px-5 py-4 border-b border-border-button flex gap-3 items-center">- <BackButton- to={`${Routes.UserSetting}${Routes.CompilationTemplates}`}- />- <h2 className="font-medium text-text-secondary">- {isCreate- ? t('setting.addTemplateGroup')- : group?.name || t('setting.editTemplateGroup')}- </h2>- </header>-- <div className="shrink-0 px-5 py-4 border-b border-border-button">- <TemplateStepper- activeStep={activeStep}- isArtifacts={isArtifacts}- onStepChange={handleStepChange}- />- </div>-- <Form {...form}>- <form className="flex-1 min-h-0 flex">- {activeStep === 2 ? (- <ResizablePanelGroup direction="horizontal" className="flex-1">- <ResizablePanel defaultSize={25} minSize={20} maxSize={40}>- <TemplateSidebar- form={form}- fields={fields}- append={append}- remove={remove}- kindOptions={kindOptions}- selectedTemplateIndex={selectedTemplateIndex}- onSelectTemplate={setSelectedTemplateIndex}- />- </ResizablePanel>- <ResizableHandle withHandle />- <ResizablePanel className="min-h-0 flex flex-col">- <TemplateConfiguration- form={form}- builtins={builtins}- kindOptions={kindOptions}- selectedTemplateIndex={selectedTemplateIndex}- onNext={handleNext}- onBack={handleBack}- isArtifacts={isArtifacts}- isLoading={isLoading}- />- </ResizablePanel>- </ResizablePanelGroup>- ) : (- <div className="flex-1 min-h-0 flex flex-col">- {activeStep === 1 && (- <>- <BasicInfoStep />- <footer className="shrink-0 px-5 py-4 border-t border-border-button flex items-center justify-end">- <Button type="button" onClick={handleNext}>- {t('common.next')}- </Button>- </footer>- </>- )}-- {activeStep === 3 && isArtifacts && (- <BlueprintsStep- form={form}- selectedTemplateIndex={selectedTemplateIndex}- onBack={() => setActiveStep(2)}- onSave={form.handleSubmit(onSubmit)}- isLoading={isLoading}- />- )}- </div>- )}- </form>- </Form>- </section>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/create-next/schema.ts b/web/src/pages/user-setting/compilation-templates/create-next/schema.tsdeleted file mode 100644index a9388f0b4c..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/schema.ts+++ /dev/null@@ -1,87 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { z } from 'zod';--export const buildSectionSchema = (t: (key: string) => string) =>- z.object({- description: z.string().optional(),- fields: z- .array(z.record(z.string().min(1, t('setting.fieldDescriptionRequired'))))- .min(1),- });--export const buildRaptorConfigSchema = (t: (key: string) => string) =>- z.object({- prompt: z.string().optional(),- max_token: z.number().min(512, t('setting.maxTokenRequired')).max(2048),- clustering_threshold: z.number().min(0).max(1),- clustering_ratio: z.number().min(0).max(1),- rechunk: z.boolean().optional(),- });--export const buildSynthesisSchema = () =>- z- .object({- compile_kwd: z.string().optional(),- enabled: z.boolean().optional(),- example: z.string().optional(),- })- .passthrough();--export const buildTemplateSchema = (t: (key: string) => string) =>- z- .object({- id: z.string().optional(),- name: z.string().min(1, t('setting.templateNameRequired')),- description: z.string().optional(),- llm_id: z.string().min(1, t('setting.llmForExtractionRequired')),- kind: z.string().min(1, t('setting.templateKindRequired')),- config: z.record(- z.union([- buildRaptorConfigSchema(t),- buildSectionSchema(t),- buildSynthesisSchema(),- z.string(),- z.boolean(),- ]),- ),- })- .superRefine((template, context) => {- if (- template.kind === 'wiki' &&- !['entity', 'topic'].includes(String(template.config.mode))- ) {- context.addIssue({- code: z.ZodIssueCode.custom,- path: ['config', 'mode'],- message: t('setting.wikiModeRequired'),- });- }- });--export const buildFormSchema = (t: (key: string) => string) =>- z.object({- name: z.string().min(1, t('setting.groupNameRequired')),- description: z.string().optional(),- avatar: z.string().optional(),- templates: z.array(buildTemplateSchema(t)).min(1),- });--export type TemplateSchemaType = z.infer<- ReturnType<typeof buildTemplateSchema>->;-export type FormSchemaType = z.infer<ReturnType<typeof buildFormSchema>>;diff --git a/web/src/pages/user-setting/compilation-templates/create-next/utils.ts b/web/src/pages/user-setting/compilation-templates/create-next/utils.tsdeleted file mode 100644index 1a01d35143..0000000000--- a/web/src/pages/user-setting/compilation-templates/create-next/utils.ts+++ /dev/null@@ -1,353 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { humanId } from 'human-id';-import { isEqual } from 'lodash';--import {- ICompilationTemplate,- ICompilationTemplateBuiltin,- ICompilationTemplateGroup,- ICompilationTemplateRaptorConfig,- ICompilationTemplateSection,-} from '@/interfaces/database/compilation-template';-import { ICompilationTemplateConfigRequest } from '@/interfaces/request/compilation-template';--import { CompilationTemplateKind } from '@/constants/compilation';--import { FormSchemaType, TemplateSchemaType } from './schema';-import {- DefaultFieldKeys,- DefaultTemplateValues,- FieldKeyOrders,- SectionPriority,-} from './constant';--export const getFieldKeyOrder = (keys: string[]): string[] => {- const sortedKeys = [...keys].sort();- return (- FieldKeyOrders.find((order) => isEqual([...order].sort(), sortedKeys)) ??- keys- );-};--export const generateTemplateName = () =>- humanId({ separator: ' ', capitalize: true });--export const isConfigMetaKey = (key: string) =>- [- 'kind',- 'llm_id',- 'global_rules',- 'example',- 'instruction',- 'synthesis',- 'use_blueprint',- 'mode',- 'rechunk',- 'rechunk_rules',- ].includes(key);--export const createEmptyField = (keys: string[]) =>- Object.fromEntries(keys.map((key) => [key, '']));--export const normalizeSection = (- section?: ICompilationTemplateSection,-): ICompilationTemplateSection => {- const fields = section?.fields ?? [];- return {- description: section?.description ?? '',- fields:- fields.length > 0- ? fields.map((field) =>- Object.fromEntries(- Object.entries(field).map(([key, value]) => [key, value ?? '']),- ),- )- : [createEmptyField(DefaultFieldKeys)],- };-};--export const buildConfigFromBuiltin = (- builtinTemplate: ICompilationTemplateBuiltin,- kind: string,- llmId: string,-): TemplateSchemaType['config'] => {- const instruction =- typeof builtinTemplate.config?.instruction === 'string'- ? builtinTemplate.config.instruction- : '';- const example =- typeof builtinTemplate.config?.example === 'string'- ? builtinTemplate.config.example- : '';- const sections: TemplateSchemaType['config'] = {- kind,- llm_id: llmId,- global_rules:- typeof builtinTemplate.config?.global_rules === 'string'- ? builtinTemplate.config.global_rules- : '',- example:- typeof builtinTemplate.config?.example === 'string'- ? builtinTemplate.config.example- : '',- ...(typeof builtinTemplate.config?.synthesis === 'object' &&- builtinTemplate.config?.synthesis !== null- ? {- synthesis: builtinTemplate.config- .synthesis as TemplateSchemaType['config']['synthesis'],- }- : {}),- use_blueprint:- kind === CompilationTemplateKind.Artifacts &&- (instruction.length > 0 || example.length > 0),- mode:- typeof builtinTemplate.config?.mode === 'string'- ? builtinTemplate.config.mode- : '',- ...(kind !== CompilationTemplateKind.Tree- ? {- rechunk: builtinTemplate.config?.rechunk === true,- rechunk_rules:- typeof builtinTemplate.config?.rechunk_rules === 'string'- ? builtinTemplate.config.rechunk_rules- : '',- }- : {}),- };-- if (- kind === CompilationTemplateKind.Artifacts &&- (instruction.length > 0 || example.length > 0)- ) {- sections.instruction = instruction;- sections.example = example;- }-- if (kind === CompilationTemplateKind.Tree) {- const builtinRaptor: ICompilationTemplateRaptorConfig =- builtinTemplate.config?.raptor ?? {};- return {- ...sections,- raptor: {- prompt: builtinRaptor.prompt ?? '',- max_token: builtinRaptor.max_token ?? 512,- clustering_threshold: builtinRaptor.clustering_threshold ?? 0.3,- clustering_ratio: builtinRaptor.clustering_ratio ?? 0.5,- rechunk: builtinRaptor.rechunk ?? false,- },- };- }-- Object.entries(builtinTemplate.config ?? {}).forEach(([key, value]) => {- if (isConfigMetaKey(key)) return;- sections[key] = normalizeSection(- value as ICompilationTemplateSection,- ) as TemplateSchemaType['config'][string];- });-- return sections;-};--export const transformDetailToForm = (- detail: ICompilationTemplate,-): TemplateSchemaType => {- const config = detail.config ?? {};- const storedInstruction =- typeof config.instruction === 'string' ? config.instruction : '';- const storedExample =- typeof config.example === 'string' ? config.example : '';- const hasBlueprintContent = Boolean(- storedInstruction.trim() || storedExample.trim(),- );- const base: TemplateSchemaType['config'] = {- kind: config.kind ?? '',- llm_id: config.llm_id ?? '',- global_rules: config.global_rules ?? '',- example: storedExample,- ...(typeof config.synthesis === 'object' && config.synthesis !== null- ? {- synthesis:- config.synthesis as TemplateSchemaType['config']['synthesis'],- }- : {}),- use_blueprint:- detail.kind === CompilationTemplateKind.Artifacts && hasBlueprintContent,- mode: typeof config.mode === 'string' ? config.mode : '',- ...(detail.kind !== CompilationTemplateKind.Tree- ? {- rechunk: config.rechunk === true,- rechunk_rules:- typeof config.rechunk_rules === 'string'- ? config.rechunk_rules- : '',- }- : {}),- };-- if (- detail.kind === CompilationTemplateKind.Artifacts &&- hasBlueprintContent- ) {- base.instruction = storedInstruction;- base.example = storedExample;- }-- if (detail.kind === CompilationTemplateKind.Tree) {- const raptor: ICompilationTemplateRaptorConfig = config.raptor ?? {};- return {- id: detail.id,- name: detail.name ?? '',- description: detail.description ?? '',- llm_id: config.llm_id ?? '',- kind: detail.kind ?? '',- config: {- ...base,- raptor: {- prompt: raptor.prompt ?? '',- max_token: raptor.max_token ?? 512,- clustering_threshold: raptor.clustering_threshold ?? 0.3,- clustering_ratio: raptor.clustering_ratio ?? 0.5,- rechunk: raptor.rechunk ?? false,- },- },- };- }-- Object.entries(config).forEach(([key, value]) => {- if (isConfigMetaKey(key)) return;- base[key] = normalizeSection(- value as ICompilationTemplateSection,- ) as TemplateSchemaType['config'][string];- });-- return {- id: detail.id,- name: detail.name ?? '',- description: detail.description ?? '',- llm_id: config.llm_id ?? '',- kind: detail.kind ?? '',- config: base,- };-};--export const transformGroupDetailToForm = (- detail: ICompilationTemplateGroup,-): FormSchemaType => {- const templates = (detail.templates ?? []).map((template) =>- transformDetailToForm(template),- );-- return {- name: detail.name ?? '',- description: detail.description ?? '',- avatar: detail.avatar ?? '',- templates: templates.length > 0 ? templates : [DefaultTemplateValues],- };-};--export const transformTemplateToPayload = (template: TemplateSchemaType) => {- const config: ICompilationTemplateConfigRequest = {- kind: template.kind,- llm_id: template.llm_id,- };-- Object.entries(template.config).forEach(([key, value]) => {- if (key === 'kind' || key === 'llm_id') return;- if (key === 'example' || key === 'instruction') return;- if (key === 'synthesis') {- config[key] = value as ICompilationTemplateConfigRequest[string];- return;- }- if (key === 'mode') {- config[key] = value as ICompilationTemplateConfigRequest[string];- return;- }- if (isConfigMetaKey(key)) {- if (typeof value === 'string' || typeof value === 'boolean')- config[key] = value;- } else {- config[key] = value as ICompilationTemplateConfigRequest[string];- }- });-- if (template.kind === CompilationTemplateKind.Artifacts) {- if (template.config.use_blueprint) {- const instruction = String(template.config.instruction ?? '').trim();- const example = String(template.config.example ?? '').trim();- config.instruction = instruction;- config.example = example;- } else {- config.instruction = '';- config.example = '';- }- }-- return {- id: template.id,- name: template.name,- description: template.description,- kind: template.kind,- config,- };-};--export const transformFormToPayload = (values: FormSchemaType) => {- return {- name: values.name,- description: values.description,- avatar: values.avatar || undefined,- templates: values.templates.map((template) =>- transformTemplateToPayload(template),- ),- };-};--export const sortSectionNames = (names: string[]): string[] => {- const priority = SectionPriority.filter((name) => names.includes(name));- const rest = names.filter((name) => !SectionPriority.includes(name));- return [...priority, ...rest];-};--export const getTypeOptionsFromBuiltinSection = (- builtinSection?: ICompilationTemplateSection,-) => {- const typeSet = new Set<string>();- builtinSection?.fields?.forEach((field) => {- if (field.type) typeSet.add(field.type);- });- return Array.from(typeSet)- .sort()- .map((value) => ({ label: value, value }));-};--export const getRequiredFieldKeys = (fieldKeys: string[]) =>- fieldKeys.includes('type') ? ['type', 'description'] : fieldKeys;--export const getAvailableTypeOptions = (- builtinSection: ICompilationTemplateSection | undefined,- existingFields: Record<string, string>[] | undefined,- editingType?: string,-) => {- const usedTypes = new Set(- (existingFields ?? []).map((field) => field.type).filter(Boolean),- );- if (editingType) usedTypes.delete(editingType);- return getTypeOptionsFromBuiltinSection(builtinSection).filter(- (option) => !usedTypes.has(option.value),- );-};diff --git a/web/src/pages/user-setting/compilation-templates/edit-next/hooks/use-edit-next-compilation-template-group.ts b/web/src/pages/user-setting/compilation-templates/edit-next/hooks/use-edit-next-compilation-template-group.tsindex 6d335c2466..3033d1ff82 100644--- a/web/src/pages/user-setting/compilation-templates/edit-next/hooks/use-edit-next-compilation-template-group.ts+++ b/web/src/pages/user-setting/compilation-templates/edit-next/hooks/use-edit-next-compilation-template-group.ts@@ -14,7 +14,6 @@* limitations under the License.*/-import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';import {useCreateCompilationTemplateGroup,useFetchCompilationTemplateGroup,@@ -32,14 +31,13 @@ import { useCompilationTemplateGroupForm } from './use-compilation-template-grouimport { useCompilationTemplateGroupSubmit } from './use-compilation-template-group-submit';type UseEditNextCompilationTemplateGroupOptions = {- onSuccess?: () => void;+ onSuccess: () => void;};export const useEditNextCompilationTemplateGroup = ({onSuccess,-}: UseEditNextCompilationTemplateGroupOptions = {}) => {+}: UseEditNextCompilationTemplateGroupOptions) => {const { id } = useParams<{ id: string }>();- const { navigateToCompilationTemplates } = useNavigatePage();const { t } = useTranslation();const isCreate = isCreateCompilationTemplateGroup(id);@@ -69,7 +67,7 @@ export const useEditNextCompilationTemplateGroup = ({id,createGroup,updateGroup,- onSuccess: onSuccess ?? navigateToCompilationTemplates,+ onSuccess,});return {@@ -80,6 +78,5 @@ export const useEditNextCompilationTemplateGroup = ({onSubmit,isCreate,isLoading: isCreate ? createLoading : updateLoading,- navigateToCompilationTemplates,};};diff --git a/web/src/pages/user-setting/compilation-templates/index.tsx b/web/src/pages/user-setting/compilation-templates/index.tsxdeleted file mode 100644index 3aa319587c..0000000000--- a/web/src/pages/user-setting/compilation-templates/index.tsx+++ /dev/null@@ -1,137 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { CardContainer } from '@/components/card-container';-import { Button } from '@/components/ui/button';-import { SearchInput } from '@/components/ui/input';-import { RAGFlowPagination } from '@/components/ui/ragflow-pagination';-import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';-import {- useDeleteCompilationTemplateGroup,- useFetchCompilationTemplateGroupsByPage,-} from '@/hooks/use-compilation-template-group-request';-import { pick } from 'lodash';-import { Plus } from 'lucide-react';-import { useCallback } from 'react';-import { useTranslation } from 'react-i18next';--import { ProfileSettingWrapperCard } from '../components/user-setting-header';-import { TemplateCard } from './template-card';--export default function CompilationTemplates() {- const { t } = useTranslation();- const {- groups,- total,- searchString,- handleInputChange,- pagination,- setPagination,- } = useFetchCompilationTemplateGroupsByPage();-- const { deleteGroup } = useDeleteCompilationTemplateGroup();- const {- navigateToCompilationTemplate,- navigateToCompilationTemplateEditNext,- } = useNavigatePage();-- const handlePageChange = useCallback(- (page: number, pageSize?: number) => {- setPagination({ page, pageSize });- },- [setPagination],- );-- const handleAdd = useCallback(() => {- navigateToCompilationTemplate('create')();- }, [navigateToCompilationTemplate]);-- const handleAddNext = useCallback(() => {- navigateToCompilationTemplateEditNext()();- }, [navigateToCompilationTemplateEditNext]);-- const handleDelete = useCallback(- async (id: string) => {- await deleteGroup(id);- },- [deleteGroup],- );-- return (- <ProfileSettingWrapperCard- header={- <header className="flex flex-col gap-4 md:flex-row md:items-center md:justify-between">- <div>- <h2 className="text-2xl font-medium text-text-primary">- {t('setting.compilationTemplates')}- </h2>-- <p className="mt-1 text-sm text-text-secondary">- {t('setting.compilationTemplatesDescription')}- </p>- </div>-- <div className="flex items-center gap-4">- <SearchInput- className="w-52"- value={searchString}- onChange={handleInputChange}- placeholder={t('common.search')}- />-- <Button onClick={handleAdd}>- <Plus />- {t('setting.addTemplateGroup')}- </Button>- <Button onClick={handleAddNext}>- <Plus />- Next- </Button>- </div>- </header>- }- >- <div className="h-full flex flex-col">- <div className="flex-1 min-h-0 overflow-x-hidden overflow-y-auto p-5">- {groups.length > 0 ? (- <CardContainer>- {groups.map((item) => (- <TemplateCard- key={item.id}- data={item}- onClick={navigateToCompilationTemplateEditNext(item.id)}- onDelete={handleDelete}- />- ))}- </CardContainer>- ) : (- <div className="flex items-center justify-center h-full text-text-secondary text-sm">- {t('setting.noTemplates')}- </div>- )}- </div>-- <div className="p-5 pt-0">- <RAGFlowPagination- {...pick(pagination, 'current', 'pageSize')}- total={total}- onChange={handlePageChange}- />- </div>- </div>- </ProfileSettingWrapperCard>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/template-card.tsx b/web/src/pages/user-setting/compilation-templates/template-card.tsxdeleted file mode 100644index 7e870121a5..0000000000--- a/web/src/pages/user-setting/compilation-templates/template-card.tsx+++ /dev/null@@ -1,92 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { MoreButton } from '@/components/more-button';-import { RAGFlowAvatar } from '@/components/ragflow-avatar';-import { Badge } from '@/components/ui/badge';-import { Card, CardContent } from '@/components/ui/card';-import { CompilationTemplateScope } from '@/constants/compilation';-import { ICompilationTemplateGroup } from '@/interfaces/database/compilation-template';-import { Database, FileText, LucideIcon } from 'lucide-react';-import { useMemo } from 'react';-import { useTranslation } from 'react-i18next';--import { formatKindLabel } from '@/utils/compilation-template-util';-import { TemplateDropdown } from './template-dropdown';--type TemplateCardProps = {- data: ICompilationTemplateGroup;- onClick?: () => void;- onDelete: (id: string) => void;-};--const ScopeIconMap: Record<string, LucideIcon> = {- [CompilationTemplateScope.File]: FileText,- [CompilationTemplateScope.Dataset]: Database,-};--function ScopeIcon({ scope }: { scope?: string }) {- const Icon = scope ? ScopeIconMap[scope] : null;-- return Icon ? <Icon className="size-4 text-text-secondary shrink-0" /> : null;-}--export function TemplateCard({ data, onClick, onDelete }: TemplateCardProps) {- const { t } = useTranslation();- const kinds = useMemo(- () => Array.from(new Set((data.templates ?? []).map((item) => item.kind))),- [data.templates],- );-- return (- <Card className="group cursor-pointer h-full" onClick={onClick}>- <CardContent className="p-4 flex gap-3">- <RAGFlowAvatar- avatar={data.avatar}- name={data.name}- className="w-8 h-8 shrink-0"- />-- <div className="flex-1 min-w-0 flex flex-col gap-1">- <section className="flex items-center justify-between gap-2">- <div className="flex items-center gap-2 min-w-0 flex-1">- <h3 className="text-base font-normal truncate text-text-primary">- {data.name}- </h3>- <ScopeIcon scope={data.scope} />- </div>-- <TemplateDropdown data={data} onDelete={onDelete}>- <MoreButton />- </TemplateDropdown>- </section>-- <p className="text-sm text-text-secondary line-clamp-1">- {data.description}- </p>-- <div className="flex flex-wrap gap-2 mt-2">- {kinds.map((kind) => (- <Badge key={kind} variant="secondary">- {formatKindLabel(t, kind)}- </Badge>- ))}- </div>- </div>- </CardContent>- </Card>- );-}diff --git a/web/src/pages/user-setting/compilation-templates/template-dropdown.tsx b/web/src/pages/user-setting/compilation-templates/template-dropdown.tsxdeleted file mode 100644index cc34eea443..0000000000--- a/web/src/pages/user-setting/compilation-templates/template-dropdown.tsx+++ /dev/null@@ -1,74 +0,0 @@-/*- * Copyright 2026 The InfiniFlow Authors. All Rights Reserved.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import {- ConfirmDeleteDialog,- ConfirmDeleteDialogNode,-} from '@/components/confirm-delete-dialog';-import {- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,-} from '@/components/ui/dropdown-menu';-import { ICompilationTemplateGroup } from '@/interfaces/database/compilation-template';-import { Trash2 } from 'lucide-react';-import { PropsWithChildren, useCallback } from 'react';-import { useTranslation } from 'react-i18next';--type TemplateDropdownProps = PropsWithChildren<{- data: ICompilationTemplateGroup;- onDelete: (id: string) => void;-}>;--export function TemplateDropdown({- children,- data,- onDelete,-}: TemplateDropdownProps) {- const { t } = useTranslation();-- const handleDelete = useCallback(() => {- onDelete(data.id);- }, [data.id, onDelete]);-- return (- <DropdownMenu>- <DropdownMenuTrigger asChild>- <div onClick={(e) => e.stopPropagation()}>{children}</div>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <ConfirmDeleteDialog- title={t('setting.deleteTemplateGroupModalTitle')}- content={{- title: t('setting.deleteTemplateGroupModalContent'),- node: <ConfirmDeleteDialogNode name={data.name} />,- }}- onOk={handleDelete}- >- <DropdownMenuItem- className="text-state-error"- onSelect={(e) => e.preventDefault()}- onClick={(e) => e.stopPropagation()}- >- {t('common.delete')}- <Trash2 className="size-4" />- </DropdownMenuItem>- </ConfirmDeleteDialog>- </DropdownMenuContent>- </DropdownMenu>- );-}diff --git a/web/src/routes.tsx b/web/src/routes.tsxindex 830aefc45e..6ea79425ce 100644--- a/web/src/routes.tsx+++ b/web/src/routes.tsx@@ -59,8 +59,6 @@ export enum Routes {Plan = '/plan',Model = '/model',Prompt = '/prompt',- CompilationTemplates = '/compilation-templates',- CompilationTemplatesCreateNext = '/compilation-templates/create-next',CompilationTemplatesEditNext = '/compilation-templates/edit-next',DataSource = '/data-source',DataSourceDetailPage = '/data-source-detail-page',@@ -322,11 +320,6 @@ const routeConfigOptions = [path: `${Routes.UserSetting}${Routes.ChatChannel}`,Component: () => import('@/pages/user-setting/chat-channel'),},- {- path: `${Routes.UserSetting}${Routes.CompilationTemplates}`,- Component: () =>- import('@/pages/user-setting/compilation-templates'),- },],},{@@ -337,18 +330,6 @@ const routeConfigOptions = [},],},- {- path: Routes.CompilationTemplatesCreateNext,- layout: false,- Component: () =>- import('@/pages/user-setting/compilation-templates/create-next'),- },- {- path: `${Routes.CompilationTemplatesCreateNext}/:id`,- layout: false,- Component: () =>- import('@/pages/user-setting/compilation-templates/create-next'),- },{path: Routes.CompilationTemplatesEditNext,layout: false,