index.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import useSWR from 'swr'
  2. import { LockClosedIcon } from '@heroicons/react/24/solid'
  3. import { useTranslation } from 'react-i18next'
  4. import Link from 'next/link'
  5. import SerpapiPlugin from './SerpapiPlugin'
  6. import { fetchPluginProviders } from '@/service/common'
  7. import type { PluginProvider } from '@/models/common'
  8. const PluginPage = () => {
  9. const { t } = useTranslation()
  10. const { data: plugins, mutate } = useSWR('/workspaces/current/tool-providers', fetchPluginProviders)
  11. const Plugin_MAP: Record<string, (plugin: PluginProvider) => JSX.Element> = {
  12. serpapi: (plugin: PluginProvider) => <SerpapiPlugin key='serpapi' plugin={plugin} onUpdate={() => mutate()} />,
  13. }
  14. return (
  15. <div className='pb-7'>
  16. <div>
  17. {plugins?.map(plugin => Plugin_MAP[plugin.tool_name](plugin))}
  18. </div>
  19. <div className='fixed bottom-0 w-[472px] h-[42px] flex items-center bg-white text-xs text-gray-500'>
  20. <LockClosedIcon className='w-3 h-3 mr-1' />
  21. {t('common.provider.encrypted.front')}
  22. <Link
  23. className='text-primary-600 mx-1'
  24. target='_blank' rel='noopener noreferrer'
  25. href='https://pycryptodome.readthedocs.io/en/latest/src/cipher/oaep.html'
  26. >
  27. PKCS1_OAEP
  28. </Link>
  29. {t('common.provider.encrypted.back')}
  30. </div>
  31. </div>
  32. )
  33. }
  34. export default PluginPage