refactor(knowledge_compiler): derive variant from template kind via single template id (#17630)

## Summary

Refactor the Go `KnowledgeCompilerComponent` so its parameter is a
**single string template id** instead of a DSL-level `variant` (or
plural group id list). The `variant` is no longer in the DSL — it is now
**derived at runtime from the resolved compilation template's `kind`
field**.

This aligns the Go ingestion port with the frontend Compiler operator,
which emits a singular `compilation_template_group_id` and does not
write `variant` into the generated `compiler.json`.
This commit is contained in:
Zhichang Yu
2026-07-31 18:01:55 +08:00
committed by GitHub
parent d1127d5973
commit 29287ef74b
29 changed files with 1714 additions and 342 deletions

View File

@@ -10,7 +10,7 @@ export function CompilationNode({ ...props }: NodeProps<IRagNode>) {
const { data } = props;
const { t } = useTranslation();
const options = useCompilationTemplateGroupOptions();
const groupId = get(data, 'form.compilation_template_group_ids');
const groupId = get(data, 'form.compilation_template_group_id');
const groupName =
options.find((option) => option.value === groupId)?.label ?? groupId;

View File

@@ -362,7 +362,7 @@ export const initialExtractorValues = {
};
export const initialCompilationValues = {
compilation_template_group_ids: [],
compilation_template_group_id: '',
outputs: {
chunks: { type: 'Array<Object>', value: [] },
},

View File

@@ -13,7 +13,7 @@ import { FormWrapper } from '../components/form-wrapper';
import { Output } from '../components/output';
export const FormSchema = z.object({
compilation_template_group_ids: z.string().optional(),
compilation_template_group_id: z.string().optional(),
});
export type CompilationFormSchemaType = z.infer<typeof FormSchema>;
@@ -33,7 +33,7 @@ const CompilationForm = ({ node }: INextOperatorForm) => {
return (
<Form {...form}>
<FormWrapper>
<CompilationTemplateFormField name="compilation_template_group_ids"></CompilationTemplateFormField>
<CompilationTemplateFormField name="compilation_template_group_id"></CompilationTemplateFormField>
<Output list={outputList}></Output>
</FormWrapper>
</Form>