fix: improve pipeline compilation, template updates, and document resets (#16815)

### What problem does this PR solve?

- Clear stale pipeline IDs and generated data when updating documents
without `pipeline_id`.
- Support tree compilation results in pipeline workflows.
- Update compilation templates in place while preserving existing
template IDs.
- Improve duplicate-template validation messages.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
- [x] New Feature (non-breaking change which adds functionality)

Co-authored-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
buua436
2026-07-10 21:17:19 +08:00
committed by GitHub
parent 30739b7f8e
commit d291e4641d
7 changed files with 266 additions and 39 deletions

View File

@@ -47,6 +47,7 @@ export interface ICreateCompilationTemplateGroupRequestBody {
description?: string;
avatar?: string;
templates: Array<{
id?: string;
name?: string;
description?: string;
kind: string;

View File

@@ -18,6 +18,7 @@ export const buildRaptorConfigSchema = (t: (key: string) => string) =>
export const buildTemplateSchema = (t: (key: string) => string) =>
z.object({
id: z.string().optional(),
name: z.string().optional(),
description: z.string().optional(),
llm_id: z.string().min(1, t('setting.llmForExtractionRequired')),

View File

@@ -30,6 +30,7 @@ export const getFieldKeyOrder = (keys: string[]): string[] => {
};
export const DefaultTemplateValues: TemplateSchemaType = {
id: undefined,
name: '',
description: '',
llm_id: '',
@@ -137,6 +138,7 @@ export const transformDetailToForm = (
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 ?? '',
@@ -161,6 +163,7 @@ export const transformDetailToForm = (
});
return {
id: detail.id,
name: detail.name ?? '',
description: detail.description ?? '',
llm_id: config.llm_id ?? '',
@@ -207,6 +210,7 @@ export const transformTemplateToPayload = (template: TemplateSchemaType) => {
}
return {
id: template.id,
name: template.name,
description: template.description,
kind: template.kind,