Feat: Enables the message operator form to reference the data defined by the begin operator #3221 (#8108)

### What problem does this PR solve?

Feat: Enables the message operator form to reference the data defined by
the begin operator #3221

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-06-06 17:54:59 +08:00
committed by GitHub
parent 1885a4a4b8
commit 0bc1f45634
30 changed files with 800 additions and 62 deletions

View File

@ -3,7 +3,7 @@ import { isEmpty } from 'lodash';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { AgentDialogueMode } from '../../constant';
import { BeginQuery } from '../../interface';
import { buildBeginInputListFromObject } from './utils';
export function useValues(node?: RAGFlowNodeType) {
const { t } = useTranslation();
@ -25,14 +25,7 @@ export function useValues(node?: RAGFlowNodeType) {
return defaultValues;
}
const inputs = Object.entries(formData?.inputs || {}).reduce<BeginQuery[]>(
(pre, [key, value]) => {
pre.push({ ...(value || {}), key });
return pre;
},
[],
);
const inputs = buildBeginInputListFromObject(formData?.inputs);
return { ...(formData || {}), inputs };
}, [defaultValues, node?.data?.form]);

View File

@ -0,0 +1,14 @@
import { BeginQuery } from '../../interface';
export function buildBeginInputListFromObject(
inputs: Record<string, Omit<BeginQuery, 'key'>>,
) {
return Object.entries(inputs || {}).reduce<BeginQuery[]>(
(pre, [key, value]) => {
pre.push({ ...(value || {}), key });
return pre;
},
[],
);
}