|
|
|
@ -1,6 +1,5 @@
|
|
|
|
import React, { useState } from 'react'
|
|
|
|
import React, { useState } from 'react'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { usePluginPageContext } from '@/app/components/plugins/plugin-page/context'
|
|
|
|
|
|
|
|
import { useAppContext } from '@/context/app-context'
|
|
|
|
import { useAppContext } from '@/context/app-context'
|
|
|
|
import Button from '@/app/components/base/button'
|
|
|
|
import Button from '@/app/components/base/button'
|
|
|
|
import Toast from '@/app/components/base/toast'
|
|
|
|
import Toast from '@/app/components/base/toast'
|
|
|
|
@ -14,19 +13,25 @@ import {
|
|
|
|
useRemoveProviderCredentials,
|
|
|
|
useRemoveProviderCredentials,
|
|
|
|
useUpdateProviderCredentials,
|
|
|
|
useUpdateProviderCredentials,
|
|
|
|
} from '@/service/use-tools'
|
|
|
|
} from '@/service/use-tools'
|
|
|
|
|
|
|
|
import type { PluginDetail } from '@/app/components/plugins/types'
|
|
|
|
|
|
|
|
|
|
|
|
const ActionList = () => {
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
detail: PluginDetail
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ActionList = ({
|
|
|
|
|
|
|
|
detail,
|
|
|
|
|
|
|
|
}: Props) => {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const { isCurrentWorkspaceManager } = useAppContext()
|
|
|
|
const { isCurrentWorkspaceManager } = useAppContext()
|
|
|
|
const currentPluginDetail = usePluginPageContext(v => v.currentPluginDetail)
|
|
|
|
const { data: provider } = useBuiltinProviderInfo(`${detail.plugin_id}/${detail.name}`)
|
|
|
|
const { data: provider } = useBuiltinProviderInfo(`${currentPluginDetail.plugin_id}/${currentPluginDetail.name}`)
|
|
|
|
|
|
|
|
const invalidateProviderInfo = useInvalidateBuiltinProviderInfo()
|
|
|
|
const invalidateProviderInfo = useInvalidateBuiltinProviderInfo()
|
|
|
|
const { data } = useBuiltinTools(`${currentPluginDetail.plugin_id}/${currentPluginDetail.name}`)
|
|
|
|
const { data } = useBuiltinTools(`${detail.plugin_id}/${detail.name}`)
|
|
|
|
|
|
|
|
|
|
|
|
const [showSettingAuth, setShowSettingAuth] = useState(false)
|
|
|
|
const [showSettingAuth, setShowSettingAuth] = useState(false)
|
|
|
|
|
|
|
|
|
|
|
|
const handleCredentialSettingUpdate = () => {
|
|
|
|
const handleCredentialSettingUpdate = () => {
|
|
|
|
invalidateProviderInfo(`${currentPluginDetail.plugin_id}/${currentPluginDetail.name}`)
|
|
|
|
invalidateProviderInfo(`${detail.plugin_id}/${detail.name}`)
|
|
|
|
Toast.notify({
|
|
|
|
Toast.notify({
|
|
|
|
type: 'success',
|
|
|
|
type: 'success',
|
|
|
|
message: t('common.api.actionSuccess'),
|
|
|
|
message: t('common.api.actionSuccess'),
|
|
|
|
@ -74,7 +79,7 @@ const ActionList = () => {
|
|
|
|
<div className='flex flex-col gap-2'>
|
|
|
|
<div className='flex flex-col gap-2'>
|
|
|
|
{data.map(tool => (
|
|
|
|
{data.map(tool => (
|
|
|
|
<ToolItem
|
|
|
|
<ToolItem
|
|
|
|
key={`${currentPluginDetail.plugin_id}${tool.name}`}
|
|
|
|
key={`${detail.plugin_id}${tool.name}`}
|
|
|
|
disabled={false}
|
|
|
|
disabled={false}
|
|
|
|
collection={provider}
|
|
|
|
collection={provider}
|
|
|
|
tool={tool}
|
|
|
|
tool={tool}
|
|
|
|
|