diff --git a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx index 546e132700..bb0ed6fb7d 100644 --- a/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx +++ b/web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx @@ -13,6 +13,8 @@ import ActionButton from '@/app/components/base/action-button' import Icon from '@/app/components/plugins/card/base/card-icon' import OrgInfo from '@/app/components/plugins/card/base/org-info' import Description from '@/app/components/plugins/card/base/description' +import TabSlider from '@/app/components/base/tab-slider-plain' + import Button from '@/app/components/base/button' import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form' import { addDefaultValue, toolParametersToFormSchemas } from '@/app/components/tools/utils/to-form-schema' @@ -20,7 +22,6 @@ import type { Collection, Tool } from '@/app/components/tools/types' import { CollectionType } from '@/app/components/tools/types' import { fetchBuiltInToolList, fetchCustomToolList, fetchModelToolList, fetchWorkflowToolList } from '@/service/tools' import I18n from '@/context/i18n' -import { DiagonalDividingLine } from '@/app/components/base/icons/src/public/common' import { getLanguage } from '@/i18n/language' import cn from '@/utils/classnames' @@ -106,30 +107,25 @@ const SettingBuiltInTool: FC = ({ })() const infoUI = ( -
+
{infoSchemas.length > 0 && ( -
-
- {t('tools.setBuiltInTools.parameters')} -
-
- {infoSchemas.map((item: any, index) => ( -
-
-
{item.label[language]}
-
{item.type === 'number-input' ? t('tools.setBuiltInTools.number') : t('tools.setBuiltInTools.string')}
- {item.required && ( -
{t('tools.setBuiltInTools.required')}
- )} -
- {item.human_description && ( -
- {item.human_description?.[language]} -
+
+ {infoSchemas.map((item: any, index) => ( +
+
+
{item.label[language]}
+
{item.type === 'number-input' ? t('tools.setBuiltInTools.number') : t('tools.setBuiltInTools.string')}
+ {item.required && ( +
{t('tools.setBuiltInTools.required')}
)}
- ))} -
+ {item.human_description && ( +
+ {item.human_description?.[language]} +
+ )} +
+ ))}
)}
@@ -194,25 +190,24 @@ const SettingBuiltInTool: FC = ({ {/* form */}
+ {(hasSetting && !readonly) ? ( + { + setCurrType(value) + }} + options={[ + { value: 'info', text: t('tools.setBuiltInTools.parameters')! }, + { value: 'setting', text: t('tools.setBuiltInTools.setting')! }, + ]} + /> + ) : ( +
{t('tools.setBuiltInTools.parameters')}
+ )}
- {(hasSetting && !readonly) && (<> - -
-
setCurrType('info')} - > - {t('tools.setBuiltInTools.parameters')} - {isInfoActive &&
} -
-
setCurrType('setting')} - > - {t('tools.setBuiltInTools.setting')} - {!isInfoActive &&
} -
-
- )} {isInfoActive ? infoUI : settingUI}
{!readonly && !isInfoActive && ( diff --git a/web/app/components/base/tab-slider-plain/index.tsx b/web/app/components/base/tab-slider-plain/index.tsx index 84846d5d71..fe243ad60b 100644 --- a/web/app/components/base/tab-slider-plain/index.tsx +++ b/web/app/components/base/tab-slider-plain/index.tsx @@ -3,12 +3,12 @@ import type { FC } from 'react' import React from 'react' import cn from '@/utils/classnames' -type Option = { +interface Option { value: string text: string | JSX.Element } -type ItemProps = { +interface ItemProps { className?: string isActive: boolean onClick: (v: string) => void @@ -23,10 +23,10 @@ const Item: FC = ({ return (
!isActive && onClick(option.value)} > -
{option.text}
+
{option.text}
{isActive && (
)} @@ -34,7 +34,7 @@ const Item: FC = ({ ) } -type Props = { +interface Props { className?: string value: string onChange: (v: string) => void @@ -52,7 +52,7 @@ const TabSlider: FC = ({ itemClassName, }) => { return ( -
+
{options.map(option => (