| 181 | }) |
| 182 | } |
| 183 | const handleDeleteTool = (data: any,index:number) => { |
| 184 | setPluginActionList((prev) => { |
| 185 | if(!data.value) { |
| 186 | prev.splice(index,1) |
| 187 | return [...prev]; |
| 188 | }else { |
| 189 | const newPluginActionList = prev.filter(item => item.value !== data.value) |
| 190 | return newPluginActionList |
| 191 | } |
| 192 | |
| 193 | }) |
| 194 | if(data.type === 'action') { |
| 195 | setActionSelectedList((prev) => { |
| 196 | const newActionSelectedList = prev.filter(item => item.action_id !== data.value) |
| 197 | return newActionSelectedList |
| 198 | }) |
| 199 | } |
| 200 | if(data.type === 'plugin') { |
| 201 | setSelectedPluginList((prev: any) => { |
| 202 | const newPluginSelectedList = prev.filter((item: any) => item !== data.value.split('/')[1]) |
| 203 | return newPluginSelectedList |
| 204 | }) |
| 205 | } |
| 206 | |
| 207 | } |
| 208 | const handleAddTool = () => { |
| 209 | setPluginActionList((prev) => { |
| 210 | const newRetrievalFormList = [...prev, { type: 'plugin', value: '' }] |