mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 00:46:52 +08:00
### What problem does this PR solve? Feat: Add retrieval tool #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -10,7 +10,6 @@ import {
|
||||
FormItem,
|
||||
FormLabel,
|
||||
} from '@/components/ui/form';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import { Position } from '@xyflow/react';
|
||||
import { useContext, useMemo } from 'react';
|
||||
@ -22,6 +21,7 @@ import { AgentInstanceContext } from '../../context';
|
||||
import { INextOperatorForm } from '../../interface';
|
||||
import useGraphStore from '../../store';
|
||||
import { isBottomSubAgent } from '../../utils';
|
||||
import { DescriptionField } from '../components/description-field';
|
||||
import { Output } from '../components/output';
|
||||
import { PromptEditor } from '../components/prompt-editor';
|
||||
import { AgentTools } from './agent-tools';
|
||||
@ -85,20 +85,7 @@ const AgentForm = ({ node }: INextOperatorForm) => {
|
||||
}}
|
||||
>
|
||||
<FormContainer>
|
||||
{isSubAgent && (
|
||||
<FormField
|
||||
control={form.control}
|
||||
name={`description`}
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex-1">
|
||||
<FormLabel>Description</FormLabel>
|
||||
<FormControl>
|
||||
<Textarea {...field}></Textarea>
|
||||
</FormControl>
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
{isSubAgent && <DescriptionField></DescriptionField>}
|
||||
<LargeModelFormField></LargeModelFormField>
|
||||
<FormField
|
||||
control={form.control}
|
||||
|
||||
@ -42,6 +42,7 @@ const Menus = [
|
||||
Operator.Invoke,
|
||||
Operator.Crawler,
|
||||
Operator.Code,
|
||||
Operator.Retrieval,
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { IAgentForm } from '@/interfaces/database/agent';
|
||||
import { DefaultAgentToolValuesMap } from '@/pages/agent/constant';
|
||||
import { AgentFormContext } from '@/pages/agent/context';
|
||||
import useGraphStore from '@/pages/agent/store';
|
||||
import { get } from 'lodash';
|
||||
@ -23,7 +24,17 @@ export function useUpdateAgentNodeTools() {
|
||||
if (node?.id) {
|
||||
const nextValue = value.reduce<IAgentForm['tools']>((pre, cur) => {
|
||||
const tool = tools.find((x) => x.component_name === cur);
|
||||
pre.push(tool ? tool : { component_name: cur, params: {} });
|
||||
pre.push(
|
||||
tool
|
||||
? tool
|
||||
: {
|
||||
component_name: cur,
|
||||
params:
|
||||
DefaultAgentToolValuesMap[
|
||||
cur as keyof typeof DefaultAgentToolValuesMap
|
||||
] || {},
|
||||
},
|
||||
);
|
||||
return pre;
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user