mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-23 23:16:58 +08:00
### What problem does this PR solve? Feat: Display chat content on the agent page #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
26 lines
559 B
TypeScript
26 lines
559 B
TypeScript
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
|
import { isEmpty } from 'lodash';
|
|
import { useMemo } from 'react';
|
|
import { initialRetrievalValues } from '../../constant';
|
|
|
|
export function useValues(node?: RAGFlowNodeType) {
|
|
const defaultValues = useMemo(
|
|
() => ({
|
|
...initialRetrievalValues,
|
|
}),
|
|
[],
|
|
);
|
|
|
|
const values = useMemo(() => {
|
|
const formData = node?.data?.form;
|
|
|
|
if (isEmpty(formData)) {
|
|
return defaultValues;
|
|
}
|
|
|
|
return formData;
|
|
}, [defaultValues, node?.data?.form]);
|
|
|
|
return values;
|
|
}
|