diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx index 59f620a64e..55a5b9e781 100644 --- a/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx +++ b/web/app/components/plugins/plugin-detail-panel/endpoint-card.tsx @@ -1,55 +1,74 @@ -import React from 'react' +import React, { useState } from 'react' import { useTranslation } from 'react-i18next' -import { RiLoginCircleLine } from '@remixicon/react' +import { RiDeleteBinLine, RiEditLine, RiLoginCircleLine } from '@remixicon/react' +import type { EndpointListItem } from '../types' +import ActionButton from '@/app/components/base/action-button' import CopyBtn from '@/app/components/base/copy-btn' import Indicator from '@/app/components/header/indicator' import Switch from '@/app/components/base/switch' -const EndpointCard = () => { +type Props = { + data: EndpointListItem +} + +const EndpointCard = ({ + data, +}: Props) => { const { t } = useTranslation() + const [active, setActive] = useState(data.enabled) + + const handleSwitch = () => { + setActive(!active) + } + return (
-
-
- -
Endpoint for Unreal workspace
-
-
-
Start Callback
-
-
https://extension.dify.ai/a1b2c3d4/onStart
- +
+
+
+ +
{data.name}
+
+
+ + + + + +
-
-
Finish Callback
-
-
https://extension.dify.ai/a1b2c3d4/onFinish
- + {data.declaration.endpoints.map((endpoint, index) => ( +
+
{endpoint.method}
+
+
{`${data.url}${endpoint.path}`}
+ +
-
+ ))}
-
-
- - {t('plugin.detailPanel.serviceOk')} -
- {/*
- - {t('plugin.detailPanel.disabled')} -
*/} +
+ {active && ( +
+ + {t('plugin.detailPanel.serviceOk')} +
+ )} + {!active && ( +
+ + {t('plugin.detailPanel.disabled')} +
+ )} {}} + defaultValue={active} + onChange={handleSwitch} size='sm' />
diff --git a/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx b/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx index 5acf1c18ab..2906d422fc 100644 --- a/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx +++ b/web/app/components/plugins/plugin-detail-panel/endpoint-list.tsx @@ -1,13 +1,14 @@ import React from 'react' import { useTranslation } from 'react-i18next' import { RiAddLine } from '@remixicon/react' +import type { EndpointListItem, PluginEndpointDeclaration } from '../types' import EndpointCard from './endpoint-card' import ActionButton from '@/app/components/base/action-button' import Tooltip from '@/app/components/base/tooltip' type Props = { - declaration: any - list: any[] + declaration: PluginEndpointDeclaration + list: EndpointListItem[] } const EndpointList = ({ @@ -22,11 +23,7 @@ const EndpointList = ({ {t('plugin.detailPanel.endpoints')} - {t('appDebug.voice.voiceSettings.resolutionTooltip').split('\n').map(item => ( -
{item}
- ))} -
+
TODO
} />
@@ -39,7 +36,10 @@ const EndpointList = ({ )}
{list.map((item, index) => ( - + ))}
diff --git a/web/app/components/plugins/plugin-detail-panel/index.tsx b/web/app/components/plugins/plugin-detail-panel/index.tsx index 17823dea23..3f60d19196 100644 --- a/web/app/components/plugins/plugin-detail-panel/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/index.tsx @@ -8,7 +8,6 @@ import EndpointList from './endpoint-list' import ActionList from './action-list' import ModelList from './model-list' import Drawer from '@/app/components/base/drawer' -// import Loading from '@/app/components/base/loading' import cn from '@/utils/classnames' type Props = { @@ -39,7 +38,6 @@ const PluginDetailPanel: FC = ({ positionCenter={false} 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 && } */} {pluginDetail && ( <>