mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-31 17:15:32 +08:00
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:
@ -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]);
|
||||
|
||||
14
web/src/pages/agent/form/begin-form/utils.ts
Normal file
14
web/src/pages/agent/form/begin-form/utils.ts
Normal 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;
|
||||
},
|
||||
[],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user