|
|
|
@ -56,8 +56,8 @@ const SettingBuiltInTool: FC<Props> = ({
|
|
|
|
const [tools, setTools] = useState<Tool[]>([])
|
|
|
|
const [tools, setTools] = useState<Tool[]>([])
|
|
|
|
const currTool = tools.find(tool => tool.name === toolName)
|
|
|
|
const currTool = tools.find(tool => tool.name === toolName)
|
|
|
|
const formSchemas = currTool ? toolParametersToFormSchemas(currTool.parameters) : []
|
|
|
|
const formSchemas = currTool ? toolParametersToFormSchemas(currTool.parameters) : []
|
|
|
|
const infoSchemas = formSchemas.filter((item: any) => item.form === 'llm')
|
|
|
|
const infoSchemas = formSchemas.filter(item => item.form === 'llm')
|
|
|
|
const settingSchemas = formSchemas.filter((item: any) => item.form !== 'llm')
|
|
|
|
const settingSchemas = formSchemas.filter(item => item.form !== 'llm')
|
|
|
|
const hasSetting = settingSchemas.length > 0
|
|
|
|
const hasSetting = settingSchemas.length > 0
|
|
|
|
const [tempSetting, setTempSetting] = useState(setting)
|
|
|
|
const [tempSetting, setTempSetting] = useState(setting)
|
|
|
|
const [currType, setCurrType] = useState('info')
|
|
|
|
const [currType, setCurrType] = useState('info')
|
|
|
|
@ -99,7 +99,7 @@ const SettingBuiltInTool: FC<Props> = ({
|
|
|
|
|
|
|
|
|
|
|
|
const isValid = (() => {
|
|
|
|
const isValid = (() => {
|
|
|
|
let valid = true
|
|
|
|
let valid = true
|
|
|
|
settingSchemas.forEach((item: any) => {
|
|
|
|
settingSchemas.forEach((item) => {
|
|
|
|
if (item.required && !tempSetting[item.name])
|
|
|
|
if (item.required && !tempSetting[item.name])
|
|
|
|
valid = false
|
|
|
|
valid = false
|
|
|
|
})
|
|
|
|
})
|
|
|
|
@ -120,7 +120,7 @@ const SettingBuiltInTool: FC<Props> = ({
|
|
|
|
<div className=''>
|
|
|
|
<div className=''>
|
|
|
|
{infoSchemas.length > 0 && (
|
|
|
|
{infoSchemas.length > 0 && (
|
|
|
|
<div className='space-y-1 py-2'>
|
|
|
|
<div className='space-y-1 py-2'>
|
|
|
|
{infoSchemas.map((item: any, index) => (
|
|
|
|
{infoSchemas.map((item, index) => (
|
|
|
|
<div key={index} className='py-1'>
|
|
|
|
<div key={index} className='py-1'>
|
|
|
|
<div className='flex items-center gap-2'>
|
|
|
|
<div className='flex items-center gap-2'>
|
|
|
|
<div className='code-sm-semibold text-text-secondary'>{item.label[language]}</div>
|
|
|
|
<div className='code-sm-semibold text-text-secondary'>{item.label[language]}</div>
|
|
|
|
@ -147,7 +147,7 @@ const SettingBuiltInTool: FC<Props> = ({
|
|
|
|
<Form
|
|
|
|
<Form
|
|
|
|
value={tempSetting}
|
|
|
|
value={tempSetting}
|
|
|
|
onChange={setTempSetting}
|
|
|
|
onChange={setTempSetting}
|
|
|
|
formSchemas={settingSchemas as any}
|
|
|
|
formSchemas={settingSchemas}
|
|
|
|
isEditMode={false}
|
|
|
|
isEditMode={false}
|
|
|
|
showOnVariableMap={{}}
|
|
|
|
showOnVariableMap={{}}
|
|
|
|
validating={false}
|
|
|
|
validating={false}
|
|
|
|
|