'use client' import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import Card from '../../card' import Button from '@/app/components/base/button' import { useUpdateModelProviders } from '@/app/components/header/account-setting/model-provider-page/hooks' import { PluginType } from '../../types' import type { Plugin, PluginDeclaration, PluginManifestInMarket } from '../../types' import { pluginManifestInMarketToPluginProps, pluginManifestToCardPluginProps } from '../utils' import Badge, { BadgeState } from '@/app/components/base/badge/index' type Props = { payload?: Plugin | PluginDeclaration | PluginManifestInMarket | null isMarketPayload?: boolean isFailed: boolean errMsg?: string | null onCancel: () => void } const Installed: FC = ({ payload, isMarketPayload, isFailed, errMsg, onCancel, }) => { const { t } = useTranslation() const updateModelProviders = useUpdateModelProviders() const handleClose = () => { onCancel() if (payload?.category === PluginType.model) updateModelProviders() } return ( <>

{(isFailed && errMsg) ? errMsg : t(`plugin.installModal.${isFailed ? 'installFailedDesc' : 'installedSuccessfullyDesc'}`)}

{payload && (
{(payload as PluginDeclaration).version || (payload as PluginManifestInMarket).latest_version}} />
)}
{/* Action Buttons */}
) } export default React.memo(Installed)