fix action list

This commit is contained in:
JzoNg 2024-11-06 17:19:51 +08:00
parent f684e1c12e
commit 2511968cb4
5 changed files with 15 additions and 8 deletions

View File

@ -1,4 +1,4 @@
import React, { useState } from 'react'
import React, { useMemo, useState } from 'react'
import useSWR from 'swr'
import { useTranslation } from 'react-i18next'
import { usePluginPageContext } from '@/app/components/plugins/plugin-page/context'
@ -18,9 +18,14 @@ const ActionList = () => {
const { t } = useTranslation()
const { isCurrentWorkspaceManager } = useAppContext()
const currentPluginDetail = usePluginPageContext(v => v.currentPluginDetail)
const providerDeclaration = currentPluginDetail.declaration.tool.identity
const providerDeclaration = useMemo(() => {
return {
...currentPluginDetail.declaration.tool.identity,
name: `${currentPluginDetail.plugin_id}/${currentPluginDetail.name}`,
}
}, [currentPluginDetail.declaration.tool.identity, currentPluginDetail.name, currentPluginDetail.plugin_id])
const { data } = useSWR(
`/workspaces/current/tool-provider/builtin/${currentPluginDetail.plugin_id}/${currentPluginDetail.name}/tools`,
`${currentPluginDetail.plugin_id}/${currentPluginDetail.name}`,
fetchBuiltInToolList,
)

View File

@ -92,7 +92,9 @@ const DetailHeader = ({
return (
<div className={cn('shrink-0 p-4 pb-3 border-b border-divider-subtle bg-components-panel-bg')}>
<div className="flex">
<Icon src={`${API_PREFIX}/workspaces/current/plugin/icon?tenant_id=${tenant_id}&filename=${icon}`} />
<div className='overflow-hidden border-components-panel-border-subtle border rounded-xl'>
<Icon src={`${API_PREFIX}/workspaces/current/plugin/icon?tenant_id=${tenant_id}&filename=${icon}`} />
</div>
<div className="ml-3 w-0 grow">
<div className="flex items-center h-5">
<Title title={label[locale]} />
@ -154,7 +156,7 @@ const DetailHeader = ({
<PluginInfo
repository={isFromGitHub ? meta?.repo : ''}
release={version}
packageName={meta?.package}
packageName={meta?.package || ''}
onHide={hidePluginInfo}
/>
)}

View File

@ -25,7 +25,7 @@ const EndpointList = () => {
params: {
plugin_id: pluginDetail.plugin_id,
page: 1,
limit: 100,
page_size: 100,
},
},
fetchEndpointList,

View File

@ -203,7 +203,7 @@ export type EndpointOperationResponse = {
result: 'success' | 'error'
}
export type EndpointsRequest = {
limit: number
page_size: number
page: number
plugin_id: string
}

View File

@ -7,7 +7,7 @@ import I18n from '@/context/i18n'
import { getLanguage } from '@/i18n/language'
import SettingBuiltInTool from '@/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool'
interface Props {
type Props = {
disabled?: boolean
collection: Collection
tool: Tool