diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index 58bc376ce..670f4845f 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -1308,6 +1308,7 @@ This delimiter is used to split the input text into several text pieces echo of management: 'Management', import: 'Import', export: 'Export', + seconds: 'Seconds', }, llmTools: { bad_calculator: { diff --git a/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx b/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx index 89bb6d820..8356758d9 100644 --- a/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx +++ b/web/src/pages/agent/canvas/node/dropdown/next-step-dropdown.tsx @@ -109,6 +109,9 @@ function AccordionOperators() { Operator.Wikipedia, Operator.GoogleScholar, Operator.ArXiv, + Operator.PubMed, + Operator.GitHub, + Operator.Invoke, ]} > diff --git a/web/src/pages/agent/constant.tsx b/web/src/pages/agent/constant.tsx index ef529fa4b..eda0b81e0 100644 --- a/web/src/pages/agent/constant.tsx +++ b/web/src/pages/agent/constant.tsx @@ -372,9 +372,15 @@ export const initialWikipediaValues = { }; export const initialPubMedValues = { - top_n: 10, + top_n: 12, email: '', - ...initialQueryBaseValues, + query: AgentGlobals.SysQuery, + outputs: { + formalized_content: { + value: '', + type: 'string', + }, + }, }; export const initialArXivValues = { @@ -444,7 +450,17 @@ export const initialDeepLValues = { export const initialGithubValues = { top_n: 5, - ...initialQueryBaseValues, + query: AgentGlobals.SysQuery, + outputs: { + formalized_content: { + value: '', + type: 'string', + }, + json: { + value: [], + type: 'Array', + }, + }, }; export const initialBaiduFanyiValues = { @@ -540,7 +556,7 @@ export const initialCrawlerValues = { }; export const initialInvokeValues = { - url: 'http://', + url: '', method: 'GET', timeout: 60, headers: `{ @@ -548,8 +564,9 @@ export const initialInvokeValues = { "Cache-Control": "no-cache", "Connection": "keep-alive" }`, - proxy: 'http://', + proxy: '', clean_html: false, + variables: [], }; export const initialTemplateValues = { @@ -852,7 +869,7 @@ export const NodeMap = { [Operator.TuShare]: 'ragNode', [Operator.Note]: 'noteNode', [Operator.Crawler]: 'ragNode', - [Operator.Invoke]: 'invokeNode', + [Operator.Invoke]: 'ragNode', [Operator.Template]: 'templateNode', [Operator.Email]: 'ragNode', [Operator.Iteration]: 'group', diff --git a/web/src/pages/agent/form/agent-form/index.tsx b/web/src/pages/agent/form/agent-form/index.tsx index e406046ce..080f19902 100644 --- a/web/src/pages/agent/form/agent-form/index.tsx +++ b/web/src/pages/agent/form/agent-form/index.tsx @@ -126,7 +126,7 @@ function AgentForm({ node }: INextOperatorForm) { name={`sys_prompt`} render={({ field }) => ( - Prompt + System Prompt >({ + defaultValues, + resolver: zodResolver(FormSchema), + mode: 'onChange', + }); + + useWatchFormChange(node?.id, form); -const GithubForm = ({ onValuesChange, form, node }: IOperatorForm) => { return ( -
- - + + + + + + + + + +
+ +
); -}; +} -export default GithubForm; +export default memo(GithubForm); diff --git a/web/src/pages/agent/form/invoke-form/dynamic-variables.tsx b/web/src/pages/agent/form/invoke-form/dynamic-variables.tsx deleted file mode 100644 index f98c04d63..000000000 --- a/web/src/pages/agent/form/invoke-form/dynamic-variables.tsx +++ /dev/null @@ -1,131 +0,0 @@ -import { EditableCell, EditableRow } from '@/components/editable-cell'; -import { useTranslate } from '@/hooks/common-hooks'; -import { DeleteOutlined } from '@ant-design/icons'; -import { Button, Collapse, Flex, Input, Select, Table, TableProps } from 'antd'; -import { trim } from 'lodash'; -import { useBuildVariableOptions } from '../../hooks/use-get-begin-query'; -import { IInvokeVariable } from '../../interface'; -import { useHandleOperateParameters } from './hooks'; - -import { RAGFlowNodeType } from '@/interfaces/database/flow'; -import styles from './index.less'; - -interface IProps { - node?: RAGFlowNodeType; -} - -const components = { - body: { - row: EditableRow, - cell: EditableCell, - }, -}; - -const DynamicVariablesForm = ({ node }: IProps) => { - const nodeId = node?.id; - const { t } = useTranslate('flow'); - - const options = useBuildVariableOptions(nodeId, node?.parentId); - const { - dataSource, - handleAdd, - handleRemove, - handleSave, - handleComponentIdChange, - handleValueChange, - } = useHandleOperateParameters(nodeId!); - - const columns: TableProps['columns'] = [ - { - title: t('key'), - dataIndex: 'key', - key: 'key', - onCell: (record: IInvokeVariable) => ({ - record, - editable: true, - dataIndex: 'key', - title: 'key', - handleSave, - }), - }, - { - title: t('componentId'), - dataIndex: 'component_id', - key: 'component_id', - align: 'center', - width: 140, - render(text, record) { - return ( - - ); - }, - }, - { - title: t('operation'), - dataIndex: 'operation', - width: 20, - key: 'operation', - align: 'center', - fixed: 'right', - render(_, record) { - return ; - }, - }, - ]; - - return ( - - {t('parameter')} - - - ), - children: ( - styles.editableRow} - scroll={{ x: true }} - bordered - /> - ), - }, - ]} - /> - ); -}; - -export default DynamicVariablesForm; diff --git a/web/src/pages/agent/form/invoke-form/index.tsx b/web/src/pages/agent/form/invoke-form/index.tsx index 521f1c95f..a6b0d63f9 100644 --- a/web/src/pages/agent/form/invoke-form/index.tsx +++ b/web/src/pages/agent/form/invoke-form/index.tsx @@ -1,8 +1,33 @@ +import { Collapse } from '@/components/collapse'; +import { FormContainer } from '@/components/form-container'; +import NumberInput from '@/components/originui/number-input'; +import { SelectWithSearch } from '@/components/originui/select-with-search'; +import { Button } from '@/components/ui/button'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; +import { Switch } from '@/components/ui/switch'; +import { zodResolver } from '@hookform/resolvers/zod'; import Editor, { loader } from '@monaco-editor/react'; -import { Form, Input, InputNumber, Select, Space, Switch } from 'antd'; +import { Plus } from 'lucide-react'; +import { memo } from 'react'; +import { useForm, useWatch } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; -import { IOperatorForm } from '../../interface'; -import DynamicVariablesForm from './dynamic-variables'; +import { initialInvokeValues } from '../../constant'; +import { useFormValues } from '../../hooks/use-form-values'; +import { useWatchFormChange } from '../../hooks/use-watch-form-change'; +import { INextOperatorForm } from '../../interface'; +import { FormWrapper } from '../components/form-wrapper'; +import { FormSchema, FormSchemaType } from './schema'; +import { useEditVariableRecord } from './use-edit-variable'; +import { VariableDialog } from './variable-dialog'; +import { VariableTable } from './variable-table'; loader.config({ paths: { vs: '/vs' } }); @@ -25,54 +50,170 @@ interface TimeoutInputProps { const TimeoutInput = ({ value, onChange }: TimeoutInputProps) => { const { t } = useTranslation(); return ( - - {t('common.s')} - +
+ {t('flow.seconds')} +
); }; -const InvokeForm = ({ onValuesChange, form, node }: IOperatorForm) => { +function InvokeForm({ node }: INextOperatorForm) { const { t } = useTranslation(); + const defaultValues = useFormValues(initialInvokeValues, node); + + const form = useForm({ + defaultValues, + resolver: zodResolver(FormSchema), + mode: 'onChange', + }); + + const { + visible, + hideModal, + showModal, + ok, + currentRecord, + otherThanCurrentQuery, + handleDeleteRecord, + } = useEditVariableRecord({ + form, + node, + }); + + const variables = useWatch({ control: form.control, name: 'variables' }); + + useWatchFormChange(node?.id, form); return ( - <> -
- - - - + + + ( + + {t('flow.url')} + + + + + + )} + /> + ( + + {t('flow.method')} + + + + + + )} + /> + ( + + {t('flow.timeout')} + + + + + + )} + /> + ( + + {t('flow.headers')} + + + + + + )} + /> + ( + + {t('flow.proxy')} + + + + + + )} + /> + ( + + + {t('flow.cleanHtml')} + + + + + + + )} + /> + {/* Create a hidden field to make Form instance record this */} +
} + /> +
+ {t('flow.parameter')}} + rightContent={ + + } > - -
- - - - - - + + + {visible && ( + + )} + + ); -}; +} -export default InvokeForm; +export default memo(InvokeForm); diff --git a/web/src/pages/agent/form/invoke-form/schema.ts b/web/src/pages/agent/form/invoke-form/schema.ts new file mode 100644 index 000000000..a3b11aff2 --- /dev/null +++ b/web/src/pages/agent/form/invoke-form/schema.ts @@ -0,0 +1,21 @@ +import { z } from 'zod'; + +export const VariableFormSchema = z.object({ + key: z.string(), + ref: z.string(), + value: z.string(), +}); + +export const FormSchema = z.object({ + url: z.string().url(), + method: z.string(), + timeout: z.number(), + headers: z.string(), + proxy: z.string().url(), + clean_html: z.boolean(), + variables: z.array(VariableFormSchema), +}); + +export type FormSchemaType = z.infer; + +export type VariableFormSchemaType = z.infer; diff --git a/web/src/pages/agent/form/invoke-form/use-edit-variable.ts b/web/src/pages/agent/form/invoke-form/use-edit-variable.ts new file mode 100644 index 000000000..40b371894 --- /dev/null +++ b/web/src/pages/agent/form/invoke-form/use-edit-variable.ts @@ -0,0 +1,70 @@ +import { useSetModalState } from '@/hooks/common-hooks'; +import { useSetSelectedRecord } from '@/hooks/logic-hooks'; +import { useCallback, useMemo, useState } from 'react'; +import { UseFormReturn, useWatch } from 'react-hook-form'; +import { INextOperatorForm } from '../../interface'; +import { FormSchemaType, VariableFormSchemaType } from './schema'; + +export const useEditVariableRecord = ({ + form, +}: INextOperatorForm & { form: UseFormReturn }) => { + const { setRecord, currentRecord } = + useSetSelectedRecord(); + + const { visible, hideModal, showModal } = useSetModalState(); + const [index, setIndex] = useState(-1); + const variables = useWatch({ + control: form.control, + name: 'variables', + }); + + const otherThanCurrentQuery = useMemo(() => { + return variables.filter((item, idx) => idx !== index); + }, [index, variables]); + + const handleEditRecord = useCallback( + (record: VariableFormSchemaType) => { + const variables = form?.getValues('variables') || []; + + const nextVaribales = + index > -1 + ? variables.toSpliced(index, 1, record) + : [...variables, record]; + + form.setValue('variables', nextVaribales); + + hideModal(); + }, + [form, hideModal, index], + ); + + const handleShowModal = useCallback( + (idx?: number, record?: VariableFormSchemaType) => { + setIndex(idx ?? -1); + setRecord(record ?? ({} as VariableFormSchemaType)); + showModal(); + }, + [setRecord, showModal], + ); + + const handleDeleteRecord = useCallback( + (idx: number) => { + const variables = form?.getValues('variables') || []; + const nextVariables = variables.filter((item, index) => index !== idx); + + form.setValue('variables', nextVariables); + }, + [form], + ); + + return { + ok: handleEditRecord, + currentRecord, + setRecord, + visible, + hideModal, + showModal: handleShowModal, + otherThanCurrentQuery, + handleDeleteRecord, + }; +}; diff --git a/web/src/pages/agent/form/invoke-form/variable-dialog.tsx b/web/src/pages/agent/form/invoke-form/variable-dialog.tsx new file mode 100644 index 000000000..8239971c8 --- /dev/null +++ b/web/src/pages/agent/form/invoke-form/variable-dialog.tsx @@ -0,0 +1,143 @@ +import { Button } from '@/components/ui/button'; +import { + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; +import { IModalProps } from '@/interfaces/common'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { isEmpty } from 'lodash'; +import { useEffect } from 'react'; +import { useForm } from 'react-hook-form'; +import { useTranslation } from 'react-i18next'; +import { z } from 'zod'; +import { QueryVariable } from '../components/query-variable'; +import { VariableFormSchemaType } from './schema'; + +type ModalFormProps = { + initialValue: VariableFormSchemaType; + otherThanCurrentQuery: VariableFormSchemaType[]; + submit(values: any): void; +}; + +const FormId = 'BeginParameterForm'; + +function VariableForm({ + initialValue, + otherThanCurrentQuery, + submit, +}: ModalFormProps) { + const { t } = useTranslation(); + const FormSchema = z.object({ + key: z + .string() + .trim() + .min(1) + .refine( + (value) => + !value || !otherThanCurrentQuery.some((x) => x.key === value), + { message: 'The key cannot be repeated!' }, + ), + ref: z.string(), + value: z.string(), + }); + + const form = useForm>({ + resolver: zodResolver(FormSchema), + mode: 'onChange', + defaultValues: { + key: '', + value: '', + ref: '', + }, + }); + + useEffect(() => { + if (!isEmpty(initialValue)) { + form.reset(initialValue); + } + }, [form, initialValue]); + + function onSubmit(data: z.infer) { + submit(data); + } + + return ( +
+ + ( + + {t('flow.key')} + + + + + + )} + /> + + ( + + {t('flow.value')} + + + + + + )} + /> + + + ); +} + +export function VariableDialog({ + initialValue, + hideModal, + otherThanCurrentQuery, + submit, +}: ModalFormProps & IModalProps) { + const { t } = useTranslation(); + + return ( + + + + {t('flow.variableSettings')} + + + + + + + + ); +} diff --git a/web/src/pages/agent/form/invoke-form/variable-table.tsx b/web/src/pages/agent/form/invoke-form/variable-table.tsx new file mode 100644 index 000000000..9a57bd4c0 --- /dev/null +++ b/web/src/pages/agent/form/invoke-form/variable-table.tsx @@ -0,0 +1,199 @@ +'use client'; + +import { + ColumnDef, + ColumnFiltersState, + SortingState, + VisibilityState, + flexRender, + getCoreRowModel, + getFilteredRowModel, + getPaginationRowModel, + getSortedRowModel, + useReactTable, +} from '@tanstack/react-table'; +import { Pencil, Trash2 } from 'lucide-react'; +import * as React from 'react'; + +import { TableEmpty } from '@/components/table-skeleton'; +import { Button } from '@/components/ui/button'; +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from '@/components/ui/table'; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from '@/components/ui/tooltip'; +import { cn } from '@/lib/utils'; +import { useTranslation } from 'react-i18next'; +import { useGetVariableLabelByValue } from '../../hooks/use-get-begin-query'; +import { VariableFormSchemaType } from './schema'; + +interface IProps { + data: VariableFormSchemaType[]; + deleteRecord(index: number): void; + showModal(index: number, record: VariableFormSchemaType): void; + nodeId?: string; +} + +export function VariableTable({ + data = [], + deleteRecord, + showModal, + nodeId, +}: IProps) { + const { t } = useTranslation(); + const getLabel = useGetVariableLabelByValue(nodeId!); + + const [sorting, setSorting] = React.useState([]); + const [columnFilters, setColumnFilters] = React.useState( + [], + ); + const [columnVisibility, setColumnVisibility] = + React.useState({}); + + const columns: ColumnDef[] = [ + { + accessorKey: 'key', + header: 'key', + meta: { cellClassName: 'max-w-30' }, + cell: ({ row }) => { + const key: string = row.getValue('key'); + return ( + + +
{key}
+
+ +

{key}

+
+
+ ); + }, + }, + { + accessorKey: 'ref', + header: t('flow.ref'), + meta: { cellClassName: 'max-w-30' }, + cell: ({ row }) => { + const ref: string = row.getValue('ref'); + const label = getLabel(ref); + return ( + + +
{label}
+
+ +

{label}

+
+
+ ); + }, + }, + { + accessorKey: 'value', + header: t('flow.value'), + cell: ({ row }) =>
{row.getValue('value')}
, + }, + { + id: 'actions', + enableHiding: false, + header: t('common.action'), + cell: ({ row }) => { + const record = row.original; + const idx = row.index; + + return ( +
+ + +
+ ); + }, + }, + ]; + + const table = useReactTable({ + data, + columns, + onSortingChange: setSorting, + onColumnFiltersChange: setColumnFilters, + getCoreRowModel: getCoreRowModel(), + getPaginationRowModel: getPaginationRowModel(), + getSortedRowModel: getSortedRowModel(), + getFilteredRowModel: getFilteredRowModel(), + onColumnVisibilityChange: setColumnVisibility, + state: { + sorting, + columnFilters, + columnVisibility, + }, + }); + + return ( +
+
+
+ + {table.getHeaderGroups().map((headerGroup) => ( + + {headerGroup.headers.map((header) => { + return ( + + {header.isPlaceholder + ? null + : flexRender( + header.column.columnDef.header, + header.getContext(), + )} + + ); + })} + + ))} + + + {table.getRowModel().rows?.length ? ( + table.getRowModel().rows.map((row) => ( + + {row.getVisibleCells().map((cell) => ( + + {flexRender( + cell.column.columnDef.cell, + cell.getContext(), + )} + + ))} + + )) + ) : ( + + )} + +
+ + + ); +} diff --git a/web/src/pages/agent/form/pubmed-form/index.tsx b/web/src/pages/agent/form/pubmed-form/index.tsx index 7532d09ee..a2c35d55c 100644 --- a/web/src/pages/agent/form/pubmed-form/index.tsx +++ b/web/src/pages/agent/form/pubmed-form/index.tsx @@ -1,3 +1,4 @@ +import { FormContainer } from '@/components/form-container'; import { TopNFormField } from '@/components/top-n-item'; import { Form, @@ -9,38 +10,81 @@ import { } from '@/components/ui/form'; import { Input } from '@/components/ui/input'; import { useTranslate } from '@/hooks/common-hooks'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { memo } from 'react'; +import { useForm, useFormContext } from 'react-hook-form'; +import { z } from 'zod'; +import { initialPubMedValues } from '../../constant'; +import { useFormValues } from '../../hooks/use-form-values'; +import { useWatchFormChange } from '../../hooks/use-watch-form-change'; import { INextOperatorForm } from '../../interface'; -import { DynamicInputVariable } from '../components/next-dynamic-input-variable'; +import { buildOutputList } from '../../utils/build-output-list'; +import { FormWrapper } from '../components/form-wrapper'; +import { Output } from '../components/output'; +import { QueryVariable } from '../components/query-variable'; -const PubMedForm = ({ form, node }: INextOperatorForm) => { +export const PubMedFormPartialSchema = { + top_n: z.number(), + email: z.string().email(), +}; + +export const FormSchema = z.object({ + ...PubMedFormPartialSchema, + query: z.string(), +}); + +export function PubMedFormWidgets() { + const form = useFormContext(); const { t } = useTranslate('flow'); + return ( + <> + + ( + + {t('email')} + + + + + + )} + /> + + ); +} + +const outputList = buildOutputList(initialPubMedValues.outputs); + +function PubMedForm({ node }: INextOperatorForm) { + const defaultValues = useFormValues(initialPubMedValues, node); + + const form = useForm>({ + defaultValues, + resolver: zodResolver(FormSchema), + mode: 'onChange', + }); + + useWatchFormChange(node?.id, form); + return (
- { - e.preventDefault(); - }} - > - - - ( - - {t('email')} - - - - - - )} - /> - + + + + + + + + +
+ +
); -}; +} -export default PubMedForm; +export default memo(PubMedForm); diff --git a/web/src/pages/agent/form/tool-form/constant.tsx b/web/src/pages/agent/form/tool-form/constant.tsx index 6f35d3073..3b7fb071f 100644 --- a/web/src/pages/agent/form/tool-form/constant.tsx +++ b/web/src/pages/agent/form/tool-form/constant.tsx @@ -1,16 +1,16 @@ import { Operator } from '../../constant'; import AkShareForm from '../akshare-form'; import DeepLForm from '../deepl-form'; -import GithubForm from '../github-form'; -import PubMedForm from '../pubmed-form'; import ArXivForm from './arxiv-form'; import BingForm from './bing-form'; import CrawlerForm from './crawler-form'; import DuckDuckGoForm from './duckduckgo-form'; import EmailForm from './email-form'; import ExeSQLForm from './exesql-form'; +import GithubForm from './github-form'; import GoogleForm from './google-form'; import GoogleScholarForm from './google-scholar-form'; +import PubMedForm from './pubmed-form'; import RetrievalForm from './retrieval-form'; import TavilyForm from './tavily-form'; import WikipediaForm from './wikipedia-form'; diff --git a/web/src/pages/agent/form/tool-form/github-form/index.tsx b/web/src/pages/agent/form/tool-form/github-form/index.tsx new file mode 100644 index 000000000..0228f5947 --- /dev/null +++ b/web/src/pages/agent/form/tool-form/github-form/index.tsx @@ -0,0 +1,36 @@ +import { FormContainer } from '@/components/form-container'; +import { TopNFormField } from '@/components/top-n-item'; +import { Form } from '@/components/ui/form'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { memo } from 'react'; +import { useForm } from 'react-hook-form'; +import { z } from 'zod'; +import { FormWrapper } from '../../components/form-wrapper'; +import { useValues } from '../use-values'; +import { useWatchFormChange } from '../use-watch-change'; + +function GithubForm() { + const values = useValues(); + + const FormSchema = z.object({ query: z.string() }); + + const form = useForm>({ + defaultValues: values, + resolver: zodResolver(FormSchema), + mode: 'onChange', + }); + + useWatchFormChange(form); + + return ( +
+ + + + + +
+ ); +} + +export default memo(GithubForm); diff --git a/web/src/pages/agent/form/tool-form/pubmed-form/index.tsx b/web/src/pages/agent/form/tool-form/pubmed-form/index.tsx new file mode 100644 index 000000000..125294d88 --- /dev/null +++ b/web/src/pages/agent/form/tool-form/pubmed-form/index.tsx @@ -0,0 +1,36 @@ +import { FormContainer } from '@/components/form-container'; +import { Form } from '@/components/ui/form'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { memo } from 'react'; +import { useForm } from 'react-hook-form'; +import { z } from 'zod'; +import { FormWrapper } from '../../components/form-wrapper'; +import { PubMedFormPartialSchema, PubMedFormWidgets } from '../../pubmed-form'; +import { useValues } from '../use-values'; +import { useWatchFormChange } from '../use-watch-change'; + +function PubMedForm() { + const values = useValues(); + + const FormSchema = z.object(PubMedFormPartialSchema); + + const form = useForm>({ + defaultValues: values, + resolver: zodResolver(FormSchema), + mode: 'onChange', + }); + + useWatchFormChange(form); + + return ( +
+ + + + + +
+ ); +} + +export default memo(PubMedForm); diff --git a/web/src/pages/agent/form/yahoo-finance-form/index.tsx b/web/src/pages/agent/form/yahoo-finance-form/index.tsx index 487eb003b..68a34836b 100644 --- a/web/src/pages/agent/form/yahoo-finance-form/index.tsx +++ b/web/src/pages/agent/form/yahoo-finance-form/index.tsx @@ -7,7 +7,6 @@ import { FormLabel, FormMessage, } from '@/components/ui/form'; -import { Input } from '@/components/ui/input'; import { Switch } from '@/components/ui/switch'; import { useTranslate } from '@/hooks/common-hooks'; import { zodResolver } from '@hookform/resolvers/zod'; @@ -21,6 +20,7 @@ import { INextOperatorForm } from '../../interface'; import { buildOutputList } from '../../utils/build-output-list'; import { FormWrapper } from '../components/form-wrapper'; import { Output } from '../components/output'; +import { QueryVariable } from '../components/query-variable'; export const YahooFinanceFormPartialSchema = { info: z.boolean(), @@ -106,19 +106,12 @@ const YahooFinanceForm = ({ node }: INextOperatorForm) => {
- ( - - {t('stockCode')} - - - - - - )} - /> + + + diff --git a/web/src/pages/agent/hooks/use-agent-tool-initial-values.ts b/web/src/pages/agent/hooks/use-agent-tool-initial-values.ts index e6dd60b89..b60aad44c 100644 --- a/web/src/pages/agent/hooks/use-agent-tool-initial-values.ts +++ b/web/src/pages/agent/hooks/use-agent-tool-initial-values.ts @@ -48,6 +48,10 @@ export function useAgentToolInitialValues() { return omit(initialValues, 'query', 'outputs'); case Operator.ArXiv: return pick(initialValues, 'top_n', 'sort_by'); + case Operator.PubMed: + return pick(initialValues, 'top_n', 'email'); + case Operator.GitHub: + return pick(initialValues, 'top_n'); default: return initialValues;