diff --git a/web/app/(commonLayout)/plugins/test/card/actions.ts b/web/app/(commonLayout)/plugins/test/card/actions.ts index 251d00d272..799d6ee8db 100644 --- a/web/app/(commonLayout)/plugins/test/card/actions.ts +++ b/web/app/(commonLayout)/plugins/test/card/actions.ts @@ -8,7 +8,7 @@ export async function handleDelete() { revalidatePath('/') } -export async function fetchPluginDetail(id: string) { +export async function fetchPluginDetail(org: string, name: string) { // Fetch plugin detail TODO - return { id } + return { org, name } } diff --git a/web/app/components/header/account-setting/model-provider-page/index.tsx b/web/app/components/header/account-setting/model-provider-page/index.tsx index 5f0ac829c1..70965c0b6b 100644 --- a/web/app/components/header/account-setting/model-provider-page/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/index.tsx @@ -185,7 +185,7 @@ const ModelProviderPage = () => { {!collapse && (
{pluginList.map((plugin, index) => ( - + ))}
)} diff --git a/web/app/components/plugins/card/card-mock.ts b/web/app/components/plugins/card/card-mock.ts index f653e711dd..d411288db7 100644 --- a/web/app/components/plugins/card/card-mock.ts +++ b/web/app/components/plugins/card/card-mock.ts @@ -1,7 +1,6 @@ import { PluginType } from '../types' export const toolNotion = { - id: 'tool-notion', type: PluginType.tool, org: 'Notion', name: 'notion page search', @@ -19,7 +18,6 @@ export const toolNotion = { } export const extensionDallE = { - id: 'extension-dalle', type: PluginType.extension, org: 'OpenAI', name: 'DALL-E', @@ -38,7 +36,6 @@ export const extensionDallE = { } export const modelGPT4 = { - id: 'model-gpt4', type: PluginType.model, org: 'OpenAI', name: 'GPT-4', diff --git a/web/app/components/plugins/plugin-detail-panel/action-list.tsx b/web/app/components/plugins/plugin-detail-panel/action-list.tsx new file mode 100644 index 0000000000..f7419406d3 --- /dev/null +++ b/web/app/components/plugins/plugin-detail-panel/action-list.tsx @@ -0,0 +1,11 @@ +import React from 'react' + +const ActionList = () => { + return ( +
+

Action List

+
+ ) +} + +export default ActionList diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx new file mode 100644 index 0000000000..ddfe434e55 --- /dev/null +++ b/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx @@ -0,0 +1,11 @@ +import React from 'react' + +const EndpointList = () => { + return ( +
+

Endpoints

+
+ ) +} + +export default EndpointList diff --git a/web/app/components/plugins/plugin-detail-panel/index.tsx b/web/app/components/plugins/plugin-detail-panel/index.tsx index 84d2afdd43..c953e45098 100644 --- a/web/app/components/plugins/plugin-detail-panel/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/index.tsx @@ -5,11 +5,15 @@ import { useTranslation } from 'react-i18next' import { usePathname, useRouter, useSearchParams } from 'next/navigation' import { RiCloseLine, RiVerifiedBadgeLine } from '@remixicon/react' import type { Plugin } from '../types' +import { PluginType } from '../types' import Badge from '../../base/badge' import Description from '../card/base/description' import Icon from '../card/base/card-icon' import Title from '../card/base/title' import OperationDropdown from './operation-dropdown' +import EndpointList from './endpoint-list' +import ActionList from './action-list' +import ModelList from './model-list' import type { Locale } from '@/i18n' import { fetchPluginDetail } from '@/app/(commonLayout)/plugins/test/card/actions' import { BoxSparkleFill } from '@/app/components/base/icons/src/vender/plugin' @@ -20,8 +24,8 @@ import Loading from '@/app/components/base/loading' import cn from '@/utils/classnames' import { // extensionDallE, - // modelGPT4, - toolNotion, + modelGPT4, + // toolNotion, } from '@/app/components/plugins/card/card-mock' type Props = { @@ -33,7 +37,8 @@ const PluginDetailPanel: FC = ({ }) => { const { t } = useTranslation() const searchParams = useSearchParams() - const pluginID = searchParams.get('pluginID') + const org = searchParams.get('org') + const name = searchParams.get('name') const router = useRouter() const pathname = usePathname() const [loading, setLoading] = useState(true) @@ -45,12 +50,14 @@ const PluginDetailPanel: FC = ({ return pluginDetail.latest_version !== pluginDetail.version }, [pluginDetail]) - const getPluginDetail = async (pluginID: string) => { + const getPluginDetail = async (org: string, name: string) => { + console.log('organization: ', org) + console.log('plugin name: ', name) setLoading(true) - const detail = await fetchPluginDetail(pluginID) + const detail = await fetchPluginDetail(org, name) setPluginDetail({ ...detail, - ...toolNotion, + ...modelGPT4, } as any) setLoading(false) } @@ -63,11 +70,11 @@ const PluginDetailPanel: FC = ({ const handleUpdate = () => {} useEffect(() => { - if (pluginID) - getPluginDetail(pluginID) - }, [pluginID]) + if (org && name) + getPluginDetail(org, name) + }, [org, name]) - if (!pluginID) + if (!org || !name) return null return ( @@ -78,11 +85,11 @@ const PluginDetailPanel: FC = ({ footer={null} mask={false} positionCenter={false} - panelClassname={cn('mt-[64px] mr-2 mb-2 !w-[420px] !max-w-[420px] !p-0 !bg-components-panel-bg rounded-2xl border-[0.5px] border-components-panel-border shadow-xl')} + panelClassname={cn('justify-start mt-[64px] mr-2 mb-2 !w-[420px] !max-w-[420px] !p-0 !bg-components-panel-bg rounded-2xl border-[0.5px] border-components-panel-border shadow-xl')} > {loading && } {!loading && pluginDetail && ( -
+ <>
@@ -102,7 +109,7 @@ const PluginDetailPanel: FC = ({
{pluginDetail.org}
-
·
+
·
@@ -116,7 +123,18 @@ const PluginDetailPanel: FC = ({
-
+
+ {pluginDetail.type === PluginType.model && ( + + )} + {pluginDetail.type !== PluginType.model && ( + <> + + + + )} +
+ )} ) diff --git a/web/app/components/plugins/plugin-detail-panel/model-list.tsx b/web/app/components/plugins/plugin-detail-panel/model-list.tsx new file mode 100644 index 0000000000..fcfecd9121 --- /dev/null +++ b/web/app/components/plugins/plugin-detail-panel/model-list.tsx @@ -0,0 +1,31 @@ +import React from 'react' +import { useTranslation } from 'react-i18next' +// import ModelIcon from '@/app/components/header/account-setting/model-provider-page/model-icon' +// import ModelName from '@/app/components/header/account-setting/model-provider-page/model-name' + +const ModelList = () => { + const { t } = useTranslation() + + return ( +
+
{t('plugin.detailPanel.modelNum', { num: 3 })}
+
+ {/* + + */} +
+
+ ) +} + +export default ModelList diff --git a/web/app/components/plugins/provider-card.tsx b/web/app/components/plugins/provider-card.tsx index 7ee0b55e86..2445c4b9ab 100644 --- a/web/app/components/plugins/provider-card.tsx +++ b/web/app/components/plugins/provider-card.tsx @@ -16,18 +16,20 @@ type Props = { className?: string locale: Locale // The component is used in both client and server side, so we can't get the locale from both side(getLocaleOnServer and useContext) payload: Plugin + installed?: boolean } const ProviderCard: FC = ({ className, locale, payload, + installed = true, }) => { const { org, label } = payload return (
- + {/* Header */}
@@ -51,24 +53,26 @@ const ProviderCard: FC = ({ ))}
-
- - -
+ + +
+ )} ) diff --git a/web/app/components/plugins/types.ts b/web/app/components/plugins/types.ts index 0c2b467326..3b8fdd12f2 100644 --- a/web/app/components/plugins/types.ts +++ b/web/app/components/plugins/types.ts @@ -8,7 +8,6 @@ export enum PluginType { } export type Plugin = { - id: string 'type': PluginType 'org': string 'name': string diff --git a/web/i18n/en-US/plugin.ts b/web/i18n/en-US/plugin.ts index 239c1fc322..26aea309ba 100644 --- a/web/i18n/en-US/plugin.ts +++ b/web/i18n/en-US/plugin.ts @@ -3,12 +3,15 @@ const translation = { endpointsEnabled: '{{num}} sets of endpoints enabled', detailPanel: { operation: { + install: 'Install', + detail: 'Detail', update: 'Update', info: 'Plugin Info', checkUpdate: 'Check Update', viewDetail: 'View Detail', remove: 'Remove', }, + modelNum: '{{num}} MODELS INCLUDED', }, } diff --git a/web/i18n/zh-Hans/plugin.ts b/web/i18n/zh-Hans/plugin.ts index e89c5bddef..3597f07784 100644 --- a/web/i18n/zh-Hans/plugin.ts +++ b/web/i18n/zh-Hans/plugin.ts @@ -3,12 +3,15 @@ const translation = { endpointsEnabled: '{{num}} 组端点已启用', detailPanel: { operation: { + install: '安装', + detail: '详情', update: '更新', info: '插件信息', checkUpdate: '检查更新', viewDetail: '查看详情', remove: '移除', }, + modelNum: '{{num}} 模型已包含', }, }