mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? Feat: Add sql form #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
34
web/src/pages/agent/hooks/use-agent-tool-initial-values.ts
Normal file
34
web/src/pages/agent/hooks/use-agent-tool-initial-values.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import { omit } from 'lodash';
|
||||
import { useCallback } from 'react';
|
||||
import { Operator } from '../constant';
|
||||
import { useInitializeOperatorParams } from './use-add-node';
|
||||
|
||||
export function useAgentToolInitialValues() {
|
||||
const { initialFormValuesMap } = useInitializeOperatorParams();
|
||||
|
||||
const initializeAgentToolValues = useCallback(
|
||||
(operatorName: Operator) => {
|
||||
const initialValues = initialFormValuesMap[operatorName];
|
||||
|
||||
switch (operatorName) {
|
||||
case Operator.Retrieval:
|
||||
return {
|
||||
...omit(initialValues, 'query'),
|
||||
description: '',
|
||||
};
|
||||
case Operator.TavilySearch:
|
||||
return {
|
||||
api_key: '',
|
||||
};
|
||||
case Operator.ExeSQL:
|
||||
return omit(initialValues, 'query');
|
||||
|
||||
default:
|
||||
return initialValues;
|
||||
}
|
||||
},
|
||||
[initialFormValuesMap],
|
||||
);
|
||||
|
||||
return { initializeAgentToolValues };
|
||||
}
|
||||
Reference in New Issue
Block a user