diff --git a/web/app/components/plugins/plugin-detail-panel/agent-strategy-list.tsx b/web/app/components/plugins/plugin-detail-panel/agent-strategy-list.tsx
index dd20403985..827a28a95e 100644
--- a/web/app/components/plugins/plugin-detail-panel/agent-strategy-list.tsx
+++ b/web/app/components/plugins/plugin-detail-panel/agent-strategy-list.tsx
@@ -1,10 +1,9 @@
import React, { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
-import ToolItem from '@/app/components/tools/provider/tool-item'
+import StrategyItem from '@/app/components/plugins/plugin-detail-panel/strategy-item'
import {
- useAllToolProviders,
- useBuiltinTools,
-} from '@/service/use-tools'
+ useStrategyProviderDetail,
+} from '@/service/use-strategy'
import type { PluginDetail } from '@/app/components/plugins/types'
type Props = {
@@ -17,31 +16,31 @@ const AgentStrategyList = ({
const { t } = useTranslation()
const providerBriefInfo = detail.declaration.agent_strategy.identity
const providerKey = `${detail.plugin_id}/${providerBriefInfo.name}`
- const { data: collectionList = [] } = useAllToolProviders()
+ const { data: strategyProviderDetail } = useStrategyProviderDetail(providerKey)
- const provider = useMemo(() => {
- return collectionList.find(collection => collection.name === providerKey)
- }, [collectionList, providerKey])
- const { data } = useBuiltinTools(providerKey)
+ const strategyList = useMemo(() => {
+ if (!strategyProviderDetail)
+ return []
- if (!data || !provider)
+ return strategyProviderDetail.declaration.strategies
+ }, [strategyProviderDetail])
+
+ if (!strategyProviderDetail)
return null
return (
- {t('plugin.detailPanel.strategyNum', { num: data.length, strategy: data.length > 1 ? 'strategies' : 'strategy' })}
+ {t('plugin.detailPanel.strategyNum', { num: strategyList.length, strategy: strategyList.length > 1 ? 'strategies' : 'strategy' })}
- {data.map(tool => (
- (
+
))}
diff --git a/web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx b/web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx
new file mode 100644
index 0000000000..a4ec6fe0c1
--- /dev/null
+++ b/web/app/components/plugins/plugin-detail-panel/strategy-detail.tsx
@@ -0,0 +1,165 @@
+'use client'
+import type { FC } from 'react'
+import React, { useMemo } from 'react'
+import { useTranslation } from 'react-i18next'
+import { useContext } from 'use-context-selector'
+import {
+ RiArrowLeftLine,
+ RiCloseLine,
+} from '@remixicon/react'
+import Drawer from '@/app/components/base/drawer'
+import ActionButton from '@/app/components/base/action-button'
+import Icon from '@/app/components/plugins/card/base/card-icon'
+import Description from '@/app/components/plugins/card/base/description'
+import Divider from '@/app/components/base/divider'
+import type {
+ StrategyDetail,
+} from '@/app/components/plugins/types'
+import type { Locale } from '@/i18n'
+import I18n from '@/context/i18n'
+import { getLanguage } from '@/i18n/language'
+import cn from '@/utils/classnames'
+
+type Props = {
+ provider: {
+ author: string
+ name: string
+ description: Record
+ icon: string
+ label: Record
+ tags: string[]
+ }
+ detail: StrategyDetail
+ onHide: () => void
+}
+
+const StrategyDetail: FC = ({
+ provider,
+ detail,
+ onHide,
+}) => {
+ const { locale } = useContext(I18n)
+ const language = getLanguage(locale)
+ const { t } = useTranslation()
+
+ const outputSchema = useMemo(() => {
+ const res: any[] = []
+ if (!detail.output_schema)
+ return []
+ Object.keys(detail.output_schema.properties).forEach((outputKey) => {
+ const output = detail.output_schema.properties[outputKey]
+ res.push({
+ name: outputKey,
+ type: output.type === 'array'
+ ? `Array[${output.items?.type.slice(0, 1).toLocaleUpperCase()}${output.items?.type.slice(1)}]`
+ : `${output.type.slice(0, 1).toLocaleUpperCase()}${output.type.slice(1)}`,
+ description: output.description,
+ })
+ })
+ return res
+ }, [detail.output_schema])
+
+ const getType = (type: string) => {
+ if (type === 'number-input')
+ return t('tools.setBuiltInTools.number')
+ if (type === 'text-input')
+ return t('tools.setBuiltInTools.string')
+ if (type === 'file')
+ return t('tools.setBuiltInTools.file')
+ if (type === 'array[tools]')
+ return 'multiple-tool-select'
+ return type
+ }
+
+ return (
+
+ <>
+ {/* header */}
+
+
+
+
+ BACK
+
+
+
+
{provider.label[language]}
+
+
{detail.identity.label[language]}
+
+
+ {/* form */}
+
+
+
{t('tools.setBuiltInTools.parameters')}
+
+ {detail.parameters.length > 0 && (
+
+ {detail.parameters.map((item: any, index) => (
+
+
+
{item.label[language]}
+
+ {getType(item.type)}
+
+ {item.required && (
+
{t('tools.setBuiltInTools.required')}
+ )}
+
+ {item.human_description && (
+
+ {item.human_description?.[language]}
+
+ )}
+
+ ))}
+
+ )}
+
+ {detail.output_schema && (
+ <>
+
+
OUTPUT
+ {outputSchema.length > 0 && (
+
+ {outputSchema.map((outputItem, index) => (
+
+
+
{outputItem.name}
+
{outputItem.type}
+
+ {outputItem.description && (
+
+ {outputItem.description}
+
+ )}
+
+ ))}
+
+ )}
+ >
+ )}
+
+
+ >
+
+ )
+}
+export default StrategyDetail
diff --git a/web/app/components/plugins/plugin-detail-panel/strategy-item.tsx b/web/app/components/plugins/plugin-detail-panel/strategy-item.tsx
new file mode 100644
index 0000000000..ff1e425fc0
--- /dev/null
+++ b/web/app/components/plugins/plugin-detail-panel/strategy-item.tsx
@@ -0,0 +1,52 @@
+'use client'
+import React, { useState } from 'react'
+import { useContext } from 'use-context-selector'
+import StrategyDetailPanel from './strategy-detail'
+import type {
+ StrategyDetail,
+} from '@/app/components/plugins/types'
+import type { Locale } from '@/i18n'
+import I18n from '@/context/i18n'
+import { getLanguage } from '@/i18n/language'
+import cn from '@/utils/classnames'
+
+type Props = {
+ provider: {
+ author: string
+ name: string
+ description: Record
+ icon: string
+ label: Record
+ tags: string[]
+ }
+ detail: StrategyDetail
+}
+
+const StrategyItem = ({
+ provider,
+ detail,
+}: Props) => {
+ const { locale } = useContext(I18n)
+ const language = getLanguage(locale)
+ const [showDetail, setShowDetail] = useState(false)
+
+ return (
+ <>
+ setShowDetail(true)}
+ >
+
{detail.identity.label[language]}
+
{detail.description[language]}
+
+ {showDetail && (
+ setShowDetail(false)}
+ />
+ )}
+ >
+ )
+}
+export default StrategyItem
diff --git a/web/app/components/plugins/types.ts b/web/app/components/plugins/types.ts
index fd8191736a..aa835687af 100644
--- a/web/app/components/plugins/types.ts
+++ b/web/app/components/plugins/types.ts
@@ -379,6 +379,8 @@ export type VersionProps = {
export type StrategyParamItem = {
name: string
label: Record
+ human_description: Record
+ llm_description: string
placeholder: Record
type: string
scope: string