From 2f5da1f6aaec5f1e4387cbb6a17b182767b19b53 Mon Sep 17 00:00:00 2001 From: Yi Date: Tue, 7 Jan 2025 16:31:15 +0800 Subject: [PATCH 01/14] fix: update model icon --- .../model-provider-page/model-icon/index.tsx | 4 ++-- .../model-parameter-modal/agent-model-trigger.tsx | 2 +- .../model-selector/model-trigger.tsx | 14 ++++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/web/app/components/header/account-setting/model-provider-page/model-icon/index.tsx b/web/app/components/header/account-setting/model-provider-page/model-icon/index.tsx index 1abaf4b891..e657106ab8 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-icon/index.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-icon/index.tsx @@ -28,11 +28,11 @@ const ModelIcon: FC = ({ if (provider?.icon_small) { return ( -
+
model-icon
) diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/agent-model-trigger.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/agent-model-trigger.tsx index 1d07e76541..c5ef343fe6 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/agent-model-trigger.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/agent-model-trigger.tsx @@ -107,7 +107,7 @@ const AgentModelTrigger: FC = ({ {modelId ? ( <> = ({ return (
-
- -
+
Date: Tue, 7 Jan 2025 16:33:58 +0800 Subject: [PATCH 02/14] feat: local install refresh --- .../hooks/use-refresh-plugin-list.tsx | 12 ++++++----- .../install-bundle/steps/install.tsx | 6 +++--- .../ready-to-install.tsx | 21 ++++++------------- 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/web/app/components/plugins/install-plugin/hooks/use-refresh-plugin-list.tsx b/web/app/components/plugins/install-plugin/hooks/use-refresh-plugin-list.tsx index 6bcb8f0321..acb486c703 100644 --- a/web/app/components/plugins/install-plugin/hooks/use-refresh-plugin-list.tsx +++ b/web/app/components/plugins/install-plugin/hooks/use-refresh-plugin-list.tsx @@ -3,7 +3,7 @@ import { useProviderContext } from '@/context/provider-context' import { useInvalidateInstalledPluginList } from '@/service/use-plugins' import { useInvalidateAllBuiltInTools, useInvalidateAllToolProviders } from '@/service/use-tools' import { useInvalidateStrategyProviders } from '@/service/use-strategy' -import type { Plugin, PluginManifestInMarket } from '../../types' +import type { Plugin, PluginDeclaration, PluginManifestInMarket } from '../../types' import { PluginType } from '../../types' const useRefreshPluginList = () => { @@ -16,25 +16,27 @@ const useRefreshPluginList = () => { const invalidateStrategyProviders = useInvalidateStrategyProviders() return { - refreshPluginList: (manifest: PluginManifestInMarket | Plugin) => { + refreshPluginList: (manifest?: PluginManifestInMarket | Plugin | PluginDeclaration | null, refreshAllType?: boolean) => { // installed list invalidateInstalledPluginList() + if (!manifest) return + // tool page, tool select - if (PluginType.tool.includes(manifest.category)) { + if (PluginType.tool.includes(manifest.category) || refreshAllType) { invalidateAllToolProviders() invalidateAllBuiltInTools() // TODO: update suggested tools. It's a function in hook useMarketplacePlugins,handleUpdatePlugins } // model select - if (PluginType.model.includes(manifest.category)) { + if (PluginType.model.includes(manifest.category) || refreshAllType) { updateModelProviders() refreshModelProviders() } // agent select - if (PluginType.agent.includes(manifest.category)) + if (PluginType.agent.includes(manifest.category) || refreshAllType) invalidateStrategyProviders() }, } diff --git a/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx b/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx index 7f33c5cef3..a1a17f2df1 100644 --- a/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx +++ b/web/app/components/plugins/install-plugin/install-bundle/steps/install.tsx @@ -7,7 +7,7 @@ import { RiLoader2Line } from '@remixicon/react' import { useTranslation } from 'react-i18next' import InstallMulti from './install-multi' import { useInstallOrUpdate } from '@/service/use-plugins' -import { useInvalidateInstalledPluginList } from '@/service/use-plugins' +import useRefreshPluginList from '../../hooks/use-refresh-plugin-list' const i18nPrefix = 'plugin.installModal' type Props = { @@ -29,7 +29,7 @@ const Install: FC = ({ const [selectedPlugins, setSelectedPlugins] = React.useState([]) const [selectedIndexes, setSelectedIndexes] = React.useState([]) const selectedPluginsNum = selectedPlugins.length - const invalidateInstalledPluginList = useInvalidateInstalledPluginList() + const { refreshPluginList } = useRefreshPluginList() const handleSelect = (plugin: Plugin, selectedIndex: number) => { const isSelected = !!selectedPlugins.find(p => p.plugin_id === plugin.plugin_id) let nextSelectedPlugins @@ -61,7 +61,7 @@ const Install: FC = ({ })) const hasInstallSuccess = res.some(r => r.success) if (hasInstallSuccess) - invalidateInstalledPluginList() + refreshPluginList(undefined, true) }, }) const handleInstall = () => { diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/ready-to-install.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/ready-to-install.tsx index f41ecd3469..78907f4494 100644 --- a/web/app/components/plugins/install-plugin/install-from-local-package/ready-to-install.tsx +++ b/web/app/components/plugins/install-plugin/install-from-local-package/ready-to-install.tsx @@ -2,12 +2,11 @@ import type { FC } from 'react' import React, { useCallback } from 'react' import type { PluginDeclaration } from '../../types' -import { InstallStep, PluginType } from '../../types' +import { InstallStep } from '../../types' import Install from './steps/install' import Installed from '../base/installed' -import { useInvalidateInstalledPluginList } from '@/service/use-plugins' -import { useUpdateModelProviders } from '@/app/components/header/account-setting/model-provider-page/hooks' -import { useInvalidateAllToolProviders } from '@/service/use-tools' +import useRefreshPluginList from '../hooks/use-refresh-plugin-list' + type Props = { step: InstallStep onStepChange: (step: InstallStep) => void, @@ -27,20 +26,12 @@ const ReadyToInstall: FC = ({ errorMsg, onError, }) => { - const invalidateInstalledPluginList = useInvalidateInstalledPluginList() - const updateModelProviders = useUpdateModelProviders() - const invalidateAllToolProviders = useInvalidateAllToolProviders() + const { refreshPluginList } = useRefreshPluginList() const handleInstalled = useCallback(() => { onStepChange(InstallStep.installed) - invalidateInstalledPluginList() - if (!manifest) - return - if (PluginType.model.includes(manifest.category)) - updateModelProviders() - if (PluginType.tool.includes(manifest.category)) - invalidateAllToolProviders() - }, [invalidateAllToolProviders, invalidateInstalledPluginList, manifest, onStepChange, updateModelProviders]) + refreshPluginList(manifest) + }, [manifest, onStepChange, refreshPluginList]) const handleFailed = useCallback((errorMsg?: string) => { onStepChange(InstallStep.installFailed) From a6d172f11103e0db46b1d293775ecb76d44e6150 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 7 Jan 2025 16:42:40 +0800 Subject: [PATCH 03/14] feat: github refresh plugin list --- .../install-from-github/index.tsx | 18 ++++++------------ .../plugins/plugin-page/empty/index.tsx | 7 +++---- .../plugin-page/install-plugin-dropdown.tsx | 4 +--- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/web/app/components/plugins/install-plugin/install-from-github/index.tsx b/web/app/components/plugins/install-plugin/install-from-github/index.tsx index d55ea4de85..71f81f0ffa 100644 --- a/web/app/components/plugins/install-plugin/install-from-github/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-github/index.tsx @@ -7,7 +7,7 @@ import type { InstallState } from '@/app/components/plugins/types' import { useGitHubReleases } from '../hooks' import { convertRepoToUrl, parseGitHubUrl } from '../utils' import type { PluginDeclaration, UpdateFromGitHubPayload } from '../../types' -import { InstallStepFromGitHub, PluginType } from '../../types' +import { InstallStepFromGitHub } from '../../types' import Toast from '@/app/components/base/toast' import SetURL from './steps/setURL' import SelectPackage from './steps/selectPackage' @@ -15,8 +15,7 @@ import Installed from '../base/installed' import Loaded from './steps/loaded' import useGetIcon from '@/app/components/plugins/install-plugin/base/use-get-icon' import { useTranslation } from 'react-i18next' -import { useUpdateModelProviders } from '@/app/components/header/account-setting/model-provider-page/hooks' -import { useInvalidateAllToolProviders } from '@/service/use-tools' +import useRefreshPluginList from '../hooks/use-refresh-plugin-list' const i18nPrefix = 'plugin.installFromGitHub' @@ -30,8 +29,8 @@ const InstallFromGitHub: React.FC = ({ updatePayload, on const { t } = useTranslation() const { getIconUrl } = useGetIcon() const { fetchReleases } = useGitHubReleases() - const updateModelProviders = useUpdateModelProviders() - const invalidateAllToolProviders = useInvalidateAllToolProviders() + const { refreshPluginList } = useRefreshPluginList() + const [state, setState] = useState({ step: updatePayload ? InstallStepFromGitHub.selectPackage : InstallStepFromGitHub.setUrl, repoUrl: updatePayload?.originalPackageInfo?.repo @@ -115,14 +114,9 @@ const InstallFromGitHub: React.FC = ({ updatePayload, on const handleInstalled = useCallback(() => { setState(prevState => ({ ...prevState, step: InstallStepFromGitHub.installed })) - if (!manifest) - return - if (PluginType.model.includes(manifest.category)) - updateModelProviders() - if (PluginType.tool.includes(manifest.category)) - invalidateAllToolProviders() + refreshPluginList(manifest) onSuccess() - }, [invalidateAllToolProviders, manifest, onSuccess, updateModelProviders]) + }, [manifest, onSuccess, refreshPluginList]) const handleFailed = useCallback((errorMsg?: string) => { setState(prevState => ({ ...prevState, step: InstallStepFromGitHub.installFailed })) diff --git a/web/app/components/plugins/plugin-page/empty/index.tsx b/web/app/components/plugins/plugin-page/empty/index.tsx index 408f724df7..3263f6a0c3 100644 --- a/web/app/components/plugins/plugin-page/empty/index.tsx +++ b/web/app/components/plugins/plugin-page/empty/index.tsx @@ -8,7 +8,7 @@ import { usePluginPageContext } from '../context' import { Group } from '@/app/components/base/icons/src/vender/other' import { useSelector as useAppContextSelector } from '@/context/app-context' import Line from '../../marketplace/empty/line' -import { useInstalledPluginList, useInvalidateInstalledPluginList } from '@/service/use-plugins' +import { useInstalledPluginList } from '@/service/use-plugins' import { useTranslation } from 'react-i18next' import { SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config' @@ -29,14 +29,13 @@ const Empty = () => { } const filters = usePluginPageContext(v => v.filters) const { data: pluginList } = useInstalledPluginList() - const invalidateInstalledPluginList = useInvalidateInstalledPluginList() const text = useMemo(() => { if (pluginList?.plugins.length === 0) return t('plugin.list.noInstalled') if (filters.categories.length > 0 || filters.tags.length > 0 || filters.searchQuery) return t('plugin.list.notFound') - }, [pluginList, filters]) + }, [pluginList?.plugins.length, t, filters.categories.length, filters.tags.length, filters.searchQuery]) return (
@@ -100,7 +99,7 @@ const Empty = () => {
{selectedAction === 'github' && { invalidateInstalledPluginList() }} + onSuccess={() => { }} onClose={() => setSelectedAction(null)} />} {selectedAction === 'local' && selectedFile diff --git a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx index e8d68e1bbf..4c2d543e14 100644 --- a/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx +++ b/web/app/components/plugins/plugin-page/install-plugin-dropdown.tsx @@ -15,7 +15,6 @@ import { PortalToFollowElemTrigger, } from '@/app/components/base/portal-to-follow-elem' import { useSelector as useAppContextSelector } from '@/context/app-context' -import { useInvalidateInstalledPluginList } from '@/service/use-plugins' import { useTranslation } from 'react-i18next' import { SUPPORT_INSTALL_LOCAL_FILE_EXTENSIONS } from '@/config' @@ -31,7 +30,6 @@ const InstallPluginDropdown = ({ const [selectedAction, setSelectedAction] = useState(null) const [selectedFile, setSelectedFile] = useState(null) const { enable_marketplace } = useAppContextSelector(s => s.systemFeatures) - const invalidateInstalledPluginList = useInvalidateInstalledPluginList() const handleFileChange = (event: React.ChangeEvent) => { const file = event.target.files?.[0] @@ -120,7 +118,7 @@ const InstallPluginDropdown = ({
{selectedAction === 'github' && { invalidateInstalledPluginList() }} + onSuccess={() => { }} onClose={() => setSelectedAction(null)} />} {selectedAction === 'local' && selectedFile From 768e1b9da38b4d3202844b1960e4951d0aaa9fcd Mon Sep 17 00:00:00 2001 From: AkaraChen Date: Tue, 7 Jan 2025 16:43:36 +0800 Subject: [PATCH 04/14] fix: wrong tooltip content for switch plugin version --- web/app/components/base/tooltip/content.tsx | 22 +++++++++++++++++++ .../components/agent-strategy-selector.tsx | 6 ++++- .../components/switch-plugin-version.tsx | 3 ++- web/app/dev-preview/page.tsx | 7 +++++- web/i18n/en-US/workflow.ts | 1 - web/i18n/zh-Hans/workflow.ts | 1 - 6 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 web/app/components/base/tooltip/content.tsx diff --git a/web/app/components/base/tooltip/content.tsx b/web/app/components/base/tooltip/content.tsx new file mode 100644 index 0000000000..fe357ccfa6 --- /dev/null +++ b/web/app/components/base/tooltip/content.tsx @@ -0,0 +1,22 @@ +import type { FC, PropsWithChildren, ReactNode } from 'react' + +export type ToolTipContentProps = { + title?: ReactNode + action?: ReactNode +} & PropsWithChildren + +export const ToolTipContent: FC = ({ + title, + action, + children, +}) => { + return ( +
+ {title && ( +
{title}
+ )} +
{children}
+ {action &&
{action}
} +
+ ) +} diff --git a/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx b/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx index c5862dab02..db684ea2df 100644 --- a/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx +++ b/web/app/components/workflow/nodes/_base/components/agent-strategy-selector.tsx @@ -20,6 +20,7 @@ import { useStrategyInfo } from '../../agent/use-config' import { SwitchPluginVersion } from './switch-plugin-version' import PluginList from '@/app/components/workflow/block-selector/market-place-plugin/list' import { useMarketplacePlugins } from '@/app/components/plugins/marketplace/hooks' +import { ToolTipContent } from '@/app/components/base/tooltip/content' const NotFoundWarn = (props: { title: ReactNode, @@ -178,7 +179,10 @@ export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) => } {showSwitchVersion && + {t('workflow.nodes.agent.strategyNotFoundDescAndSwitchVersion')} + } onChange={() => { // TODO: refresh all strategies }} diff --git a/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx b/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx index ad7414ca0c..e459a4b49e 100644 --- a/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx +++ b/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx @@ -4,6 +4,7 @@ import Badge from '@/app/components/base/badge' import Tooltip from '@/app/components/base/tooltip' import PluginVersionPicker from '@/app/components/plugins/update-plugin/plugin-version-picker' import { RiArrowLeftRightLine } from '@remixicon/react' +import type { ReactNode } from 'react' import { type FC, useCallback, useState } from 'react' import cn from '@/utils/classnames' import UpdateFromMarketplace from '@/app/components/plugins/update-plugin/from-market-place' @@ -12,7 +13,7 @@ import { useCheckInstalled } from '@/service/use-plugins' export type SwitchPluginVersionProps = { uniqueIdentifier: string - tooltip?: string + tooltip?: ReactNode onChange?: (version: string) => void } diff --git a/web/app/dev-preview/page.tsx b/web/app/dev-preview/page.tsx index 49afe537cd..24631aa28e 100644 --- a/web/app/dev-preview/page.tsx +++ b/web/app/dev-preview/page.tsx @@ -1,5 +1,6 @@ 'use client' +import { ToolTipContent } from '../components/base/tooltip/content' import { SwitchPluginVersion } from '../components/workflow/nodes/_base/components/switch-plugin-version' import { useTranslation } from 'react-i18next' @@ -8,7 +9,11 @@ export default function Page() { return
+ {t('workflow.nodes.agent.strategyNotFoundDescAndSwitchVersion')} + } />
} diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index 858f69db94..a9b0fe5587 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -755,7 +755,6 @@ const translation = { checkList: { strategyNotSelected: 'Strategy not selected', }, - switchToNewVersion: 'Switch to new version', }, tracing: { stopBy: 'Stop by {{user}}', diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index b90fec2371..11996ae982 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -754,7 +754,6 @@ const translation = { checkList: { strategyNotSelected: '未选择策略', }, - switchToNewVersion: '切换到新版', }, }, tracing: { From 85610651c0fa0a87cdd75e8b35e4e304b784cc07 Mon Sep 17 00:00:00 2001 From: Yi Date: Tue, 7 Jan 2025 16:57:01 +0800 Subject: [PATCH 05/14] node ui fix --- .../model-parameter-modal/agent-model-trigger.tsx | 4 ---- .../model-provider-page/model-selector/model-trigger.tsx | 2 +- web/app/components/plugins/types.ts | 1 + web/app/components/workflow/nodes/agent/node.tsx | 2 +- web/app/components/workflow/nodes/llm/node.tsx | 1 + .../components/workflow/nodes/parameter-extractor/node.tsx | 1 + .../components/workflow/nodes/question-classifier/node.tsx | 1 + 7 files changed, 6 insertions(+), 6 deletions(-) diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/agent-model-trigger.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/agent-model-trigger.tsx index c5ef343fe6..6cc21699c4 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/agent-model-trigger.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/agent-model-trigger.tsx @@ -24,8 +24,6 @@ import { InstallPluginButton } from '@/app/components/workflow/nodes/_base/compo import StatusIndicators from './status-indicators' import cn from '@/utils/classnames' import { useProviderContext } from '@/context/provider-context' -import { useModalContextSelector } from '@/context/modal-context' -import { useEventEmitterContextContext } from '@/context/event-emitter' import { RiEqualizer2Line } from '@remixicon/react' import { fetchPluginInfoFromMarketPlace } from '@/service/plugins' @@ -51,10 +49,8 @@ const AgentModelTrigger: FC = ({ }) => { const { t } = useTranslation() const { modelProviders } = useProviderContext() - const setShowModelModal = useModalContextSelector(state => state.setShowModelModal) const updateModelProviders = useUpdateModelProviders() const updateModelList = useUpdateModelList() - const { eventEmitter } = useEventEmitterContextContext() const { modelProvider, needsConfiguration } = useMemo(() => { const modelProvider = modelProviders.find(item => item.provider === providerName) const needsConfiguration = modelProvider?.custom_configuration.status === CustomConfigurationStatusEnum.noConfigure && !( diff --git a/web/app/components/header/account-setting/model-provider-page/model-selector/model-trigger.tsx b/web/app/components/header/account-setting/model-provider-page/model-selector/model-trigger.tsx index 353e9890d9..009887acd7 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-selector/model-trigger.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-selector/model-trigger.tsx @@ -34,7 +34,7 @@ const ModelTrigger: FC = ({ return (
> = (props) => { return > = ({ )} diff --git a/web/app/components/workflow/nodes/parameter-extractor/node.tsx b/web/app/components/workflow/nodes/parameter-extractor/node.tsx index 8a1b08e924..d79ae717d9 100644 --- a/web/app/components/workflow/nodes/parameter-extractor/node.tsx +++ b/web/app/components/workflow/nodes/parameter-extractor/node.tsx @@ -21,6 +21,7 @@ const Node: FC> = ({ )} diff --git a/web/app/components/workflow/nodes/question-classifier/node.tsx b/web/app/components/workflow/nodes/question-classifier/node.tsx index 8ca721fbef..8316c3b259 100644 --- a/web/app/components/workflow/nodes/question-classifier/node.tsx +++ b/web/app/components/workflow/nodes/question-classifier/node.tsx @@ -32,6 +32,7 @@ const Node: FC> = (props) => { {hasSetModel && ( From 55ad1fe1f01727c4a2614752a2e07d83f530c752 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 7 Jan 2025 16:58:20 +0800 Subject: [PATCH 06/14] chore: tool selelct use the same tools data --- web/app/components/workflow/block-selector/tabs.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/app/components/workflow/block-selector/tabs.tsx b/web/app/components/workflow/block-selector/tabs.tsx index 5404232f93..bcb54a79dc 100644 --- a/web/app/components/workflow/block-selector/tabs.tsx +++ b/web/app/components/workflow/block-selector/tabs.tsx @@ -1,6 +1,6 @@ import type { FC } from 'react' import { memo } from 'react' -import { useStore } from '../store' +import { useAllBuiltInTools, useAllCustomTools, useAllWorkflowTools } from '@/service/use-tools' import type { BlockEnum } from '../types' import { useTabs } from './hooks' import type { ToolDefaultValue } from './types' @@ -28,9 +28,9 @@ const Tabs: FC = ({ noBlocks, }) => { const tabs = useTabs() - const buildInTools = useStore(s => s.buildInTools) - const customTools = useStore(s => s.customTools) - const workflowTools = useStore(s => s.workflowTools) + const { data: buildInTools } = useAllBuiltInTools() + const { data: customTools } = useAllCustomTools() + const { data: workflowTools } = useAllWorkflowTools() return (
e.stopPropagation()}> From 60063807239d8286134f30f6cd0b9cadca7a6069 Mon Sep 17 00:00:00 2001 From: Joel Date: Tue, 7 Jan 2025 17:10:27 +0800 Subject: [PATCH 07/14] fix: tool select ui problem in workflow --- web/app/components/workflow/block-selector/all-tools.tsx | 3 +++ web/app/components/workflow/block-selector/tool-picker.tsx | 1 + 2 files changed, 4 insertions(+) diff --git a/web/app/components/workflow/block-selector/all-tools.tsx b/web/app/components/workflow/block-selector/all-tools.tsx index d27fb6385b..9f0596d9b1 100644 --- a/web/app/components/workflow/block-selector/all-tools.tsx +++ b/web/app/components/workflow/block-selector/all-tools.tsx @@ -22,6 +22,7 @@ import { useMarketplacePlugins } from '../../plugins/marketplace/hooks' type AllToolsProps = { className?: string + toolContentClassName?: string searchText: string tags: string[] buildInTools: ToolWithProvider[] @@ -34,6 +35,7 @@ type AllToolsProps = { } const AllTools = ({ className, + toolContentClassName, searchText, tags = [], onSelect, @@ -130,6 +132,7 @@ const AllTools = ({ onScroll={(pluginRef.current as any)?.handleScroll} > = ({
Date: Wed, 8 Jan 2025 10:03:00 +0800 Subject: [PATCH 08/14] fix: switch plugin version --- .../nodes/_base/components/switch-plugin-version.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx b/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx index e459a4b49e..c375d3198a 100644 --- a/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx +++ b/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx @@ -34,6 +34,11 @@ export const SwitchPluginVersion: FC = (props) => { pluginDetails.refetch() onChange?.(targetVersion!) }, [hideUpdateModal, onChange, pluginDetails, targetVersion]) + + const targetUniqueIdentifier = (() => { + if (!targetVersion || !pluginDetail) return uniqueIdentifier + return uniqueIdentifier.replaceAll(pluginDetail.version, targetVersion) + })() return
{isShowUpdateModal && pluginDetail && = (props) => { payload: pluginDetail.declaration, }, targetPackageInfo: { - id: uniqueIdentifier, + id: targetUniqueIdentifier, version: targetVersion!, }, }} From 3cbb288a25476ab94b825eccd8b2949a44458ddf Mon Sep 17 00:00:00 2001 From: Yi Date: Wed, 8 Jan 2025 10:09:11 +0800 Subject: [PATCH 09/14] feat: add version check i18n --- .../header/account-setting/model-provider-page/index.tsx | 8 -------- web/i18n/en-US/workflow.ts | 4 ++++ web/i18n/zh-Hans/workflow.ts | 4 ++++ 3 files changed, 8 insertions(+), 8 deletions(-) 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 2e09fe93b1..f77974abaf 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 @@ -24,16 +24,12 @@ import { useDefaultModel, useMarketplaceAllPlugins, useModelModalHandler, - useUpdateModelList, - useUpdateModelProviders, } from './hooks' import Divider from '@/app/components/base/divider' import Loading from '@/app/components/base/loading' import ProviderCard from '@/app/components/plugins/provider-card' import List from '@/app/components/plugins/marketplace/list' import { useProviderContext } from '@/context/provider-context' -import { useModalContextSelector } from '@/context/modal-context' -import { useEventEmitterContextContext } from '@/context/event-emitter' import type { Plugin } from '@/app/components/plugins/types' import { MARKETPLACE_URL_PREFIX } from '@/config' import cn from '@/utils/classnames' @@ -46,16 +42,12 @@ type Props = { const ModelProviderPage = ({ searchText }: Props) => { const debouncedSearchText = useDebounce(searchText, { wait: 500 }) const { t } = useTranslation() - const { eventEmitter } = useEventEmitterContextContext() - const updateModelProviders = useUpdateModelProviders() - const updateModelList = useUpdateModelList() const { data: textGenerationDefaultModel } = useDefaultModel(ModelTypeEnum.textGeneration) const { data: embeddingsDefaultModel } = useDefaultModel(ModelTypeEnum.textEmbedding) const { data: rerankDefaultModel } = useDefaultModel(ModelTypeEnum.rerank) const { data: speech2textDefaultModel } = useDefaultModel(ModelTypeEnum.speech2text) const { data: ttsDefaultModel } = useDefaultModel(ModelTypeEnum.tts) const { modelProviders: providers } = useProviderContext() - const setShowModelModal = useModalContextSelector(state => state.setShowModelModal) const defaultModelNotConfigured = !textGenerationDefaultModel && !embeddingsDefaultModel && !speech2textDefaultModel && !rerankDefaultModel && !ttsDefaultModel const [configuredProviders, notConfiguredProviders] = useMemo(() => { const configuredProviders: ModelProvider[] = [] diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index a9b0fe5587..279654a857 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -722,6 +722,10 @@ const translation = { desc: 'This model is installed from Local or GitHub repository. Please use after installation.', manageInPlugins: 'Manage in Plugins', }, + modelNotSupport: { + title: 'Unsupported Model', + desc: 'The installed plugin version does not provide this model.', + }, configureModel: 'Configure Model', notAuthorized: 'Not Authorized', model: 'model', diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index 11996ae982..80c53702ab 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -722,6 +722,10 @@ const translation = { desc: '此模型安装自本地或 GitHub 仓库。请安装后使用。', manageInPlugins: '在插件中管理', }, + modelNotSupport: { + title: '不支持的模型', + desc: '已安装的插件版本不提供此模型。', + }, model: '模型', toolbox: '工具箱', strategyNotSet: '代理策略未设置', From d17932d7238c4d2174fd281b8c65e1c1c3996f63 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Wed, 8 Jan 2025 10:12:27 +0800 Subject: [PATCH 10/14] fix: install task icon --- .../plugin-page/plugin-tasks/index.tsx | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx b/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx index 9d7345c22e..328cc2a868 100644 --- a/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx +++ b/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx @@ -21,6 +21,7 @@ import CardIcon from '@/app/components/plugins/card/base/card-icon' import cn from '@/utils/classnames' import { useGetLanguage } from '@/context/i18n' import useGetIcon from '@/app/components/plugins/install-plugin/base/use-get-icon' +import DownloadingIcon from '@/app/components/header/plugins-nav/downloading-icon' const PluginTasks = () => { const { t } = useTranslation() @@ -87,12 +88,21 @@ const PluginTasks = () => { (isInstallingWithError || isFailed) && 'border-components-button-destructive-secondary-border-hover bg-state-destructive-hover hover:bg-state-destructive-hover-alt cursor-pointer', )} > - + { + (isInstalling || isInstallingWithError) && ( + + ) + } + { + !(isInstalling || isInstallingWithError) && ( + + ) + }
{ (isInstalling || isInstallingWithSuccess) && ( From adf0d94a9a6643745b44807ee3a07673aa397505 Mon Sep 17 00:00:00 2001 From: JzoNg Date: Wed, 8 Jan 2025 11:51:44 +0800 Subject: [PATCH 11/14] unsupported actions --- .../plugins/plugin-detail-panel/index.tsx | 22 ------------- .../tool-selector/index.tsx | 32 ++++++++++++------- .../tool-selector/tool-item.tsx | 30 ++++++++++++++--- .../components/switch-plugin-version.tsx | 7 ++-- web/i18n/en-US/plugin.ts | 3 ++ web/i18n/zh-Hans/plugin.ts | 3 ++ 6 files changed, 56 insertions(+), 41 deletions(-) diff --git a/web/app/components/plugins/plugin-detail-panel/index.tsx b/web/app/components/plugins/plugin-detail-panel/index.tsx index 692b2ecd26..4d20c0877d 100644 --- a/web/app/components/plugins/plugin-detail-panel/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/index.tsx @@ -9,7 +9,6 @@ import AgentStrategyList from './agent-strategy-list' import Drawer from '@/app/components/base/drawer' import type { PluginDetail } from '@/app/components/plugins/types' import cn from '@/utils/classnames' -import ToolSelector from '@/app/components/plugins/plugin-detail-panel/tool-selector' type Props = { detail?: PluginDetail @@ -28,16 +27,6 @@ const PluginDetailPanel: FC = ({ onUpdate() } - const [value, setValue] = React.useState({ - provider_name: 'langgenius/google/google', - tool_name: 'google_search', - }) - - const testHandle = (item: any) => { - console.log(item) - setValue(item) - } - if (!detail) return null @@ -63,17 +52,6 @@ const PluginDetailPanel: FC = ({ {!!detail.declaration.agent_strategy && } {!!detail.declaration.endpoint && } {!!detail.declaration.model && } - {false && ( -
- testHandle(item)} - onDelete={() => testHandle(null)} - supportEnableSwitch - /> -
- )}
)} diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx index 220edc22ca..e20673f7fa 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/index.tsx @@ -102,7 +102,7 @@ const ToolSelector: FC = ({ const currentProvider = useMemo(() => { const mergedTools = [...(buildInTools || []), ...(customTools || []), ...(workflowTools || [])] return mergedTools.find((toolWithProvider) => { - return toolWithProvider.id === value?.provider_name && toolWithProvider.tools.some(tool => tool.name === value?.tool_name) + return toolWithProvider.id === value?.provider_name }) }, [value, buildInTools, customTools, workflowTools]) @@ -172,7 +172,9 @@ const ToolSelector: FC = ({ }) // install from marketplace - + const currentTool = useMemo(() => { + return currentProvider?.tools.find(tool => tool.name === value?.tool_name) + }, [currentProvider?.tools, value?.tool_name]) const manifestIcon = useMemo(() => { if (!manifest) return '' @@ -193,7 +195,10 @@ const ToolSelector: FC = ({ > { + if (!currentProvider || !currentTool) return + handleTriggerClick() + }} > {trigger} {!trigger && !value?.provider_name && ( @@ -214,19 +219,22 @@ const ToolSelector: FC = ({ switchValue={value.enabled} onSwitchChange={handleEnabledChange} onDelete={onDelete} - noAuth={currentProvider && !currentProvider.is_team_authorization} + noAuth={currentProvider && currentTool && !currentProvider.is_team_authorization} onAuth={() => setShowSettingAuth(true)} uninstalled={!currentProvider && inMarketPlace} + versionMismatch={currentProvider && inMarketPlace && !currentTool} installInfo={manifest?.latest_package_identifier} onInstall={() => handleInstall()} - isError={!currentProvider && !inMarketPlace} - errorTip={
-

{t('plugin.detailPanel.toolSelector.uninstalledTitle')}

-

{t('plugin.detailPanel.toolSelector.uninstalledContent')}

-

- {t('plugin.detailPanel.toolSelector.uninstalledLink')} -

-
} + isError={(!currentProvider || !currentTool) && !inMarketPlace} + errorTip={ +
+

{currentTool ? t('plugin.detailPanel.toolSelector.uninstalledTitle') : t('plugin.detailPanel.toolSelector.unsupportedTitle')}

+

{currentTool ? t('plugin.detailPanel.toolSelector.uninstalledContent') : t('plugin.detailPanel.toolSelector.unsupportedContent')}

+

+ {t('plugin.detailPanel.toolSelector.uninstalledLink')} +

+
+ } /> )}
diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx index 45a9abd592..3e32e66929 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/tool-item.tsx @@ -13,7 +13,9 @@ import Button from '@/app/components/base/button' import Indicator from '@/app/components/header/indicator' import ActionButton from '@/app/components/base/action-button' import Tooltip from '@/app/components/base/tooltip' +import { ToolTipContent } from '@/app/components/base/tooltip/content' import { InstallPluginButton } from '@/app/components/workflow/nodes/_base/components/install-plugin-button' +import { SwitchPluginVersion } from '@/app/components/workflow/nodes/_base/components/switch-plugin-version' import cn from '@/utils/classnames' type Props = { @@ -31,6 +33,7 @@ type Props = { uninstalled?: boolean installInfo?: string onInstall?: () => void + versionMismatch?: boolean open: boolean } @@ -50,10 +53,11 @@ const ToolItem = ({ onInstall, isError, errorTip, + versionMismatch, }: Props) => { const { t } = useTranslation() const providerNameText = providerName?.split('/').pop() - const isTransparent = uninstalled || isError + const isTransparent = uninstalled || versionMismatch || isError const [isDeleting, setIsDeleting] = useState(false) return ( @@ -82,7 +86,7 @@ const ToolItem = ({
{toolName}
- {!noAuth && !isError && !uninstalled && ( + {!noAuth && !isError && !uninstalled && !versionMismatch && ( @@ -99,7 +103,7 @@ const ToolItem = ({
- {!isError && !uninstalled && !noAuth && showSwitch && ( + {!isError && !uninstalled && !noAuth && !versionMismatch && showSwitch && (
e.stopPropagation()}>
)} - {!isError && !uninstalled && noAuth && ( + {!isError && !uninstalled && !versionMismatch && noAuth && ( )} + {!isError && !uninstalled && versionMismatch && installInfo && ( +
e.stopPropagation()}> + + {`${t('plugin.detailPanel.toolSelector.unsupportedContent')} ${t('plugin.detailPanel.toolSelector.unsupportedContent2')}`} + + } + onChange={() => { + onInstall?.() + }} + /> +
+ )} {!isError && uninstalled && installInfo && ( e.stopPropagation()} diff --git a/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx b/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx index c375d3198a..8f6f751bc3 100644 --- a/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx +++ b/web/app/components/workflow/nodes/_base/components/switch-plugin-version.tsx @@ -6,19 +6,20 @@ import PluginVersionPicker from '@/app/components/plugins/update-plugin/plugin-v import { RiArrowLeftRightLine } from '@remixicon/react' import type { ReactNode } from 'react' import { type FC, useCallback, useState } from 'react' -import cn from '@/utils/classnames' import UpdateFromMarketplace from '@/app/components/plugins/update-plugin/from-market-place' import { useBoolean } from 'ahooks' import { useCheckInstalled } from '@/service/use-plugins' +import cn from '@/utils/classnames' export type SwitchPluginVersionProps = { uniqueIdentifier: string tooltip?: ReactNode onChange?: (version: string) => void + className?: string } export const SwitchPluginVersion: FC = (props) => { - const { uniqueIdentifier, tooltip, onChange } = props + const { uniqueIdentifier, tooltip, onChange, className } = props const [pluginId] = uniqueIdentifier.split(':') const [isShow, setIsShow] = useState(false) const [isShowUpdateModal, { setTrue: showUpdateModal, setFalse: hideUpdateModal }] = useBoolean(false) @@ -40,7 +41,7 @@ export const SwitchPluginVersion: FC = (props) => { return uniqueIdentifier.replaceAll(pluginDetail.version, targetVersion) })() return -
+
{isShowUpdateModal && pluginDetail && Date: Wed, 8 Jan 2025 12:37:33 +0800 Subject: [PATCH 12/14] chore: plugin mutation modal component --- .../plugins/plugin-mutation-model/index.tsx | 71 +++++++++++++++++++ web/service/use-plugins.ts | 5 +- 2 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 web/app/components/plugins/plugin-mutation-model/index.tsx diff --git a/web/app/components/plugins/plugin-mutation-model/index.tsx b/web/app/components/plugins/plugin-mutation-model/index.tsx new file mode 100644 index 0000000000..fadfd9a957 --- /dev/null +++ b/web/app/components/plugins/plugin-mutation-model/index.tsx @@ -0,0 +1,71 @@ +import type { FC, ReactNode } from 'react' +import React, { memo } from 'react' +import Card from '@/app/components/plugins/card' +import Modal from '@/app/components/base/modal' +import Button from '@/app/components/base/button' +import type { Plugin } from '../types' +import type { UseMutationResult } from '@tanstack/react-query' + +type Props = { + plugin: Plugin + onSave: () => void + onCancel: () => void + mutation: UseMutationResult + confirmButtonText: ReactNode + cancelButtonText: ReactNode + modelTitle: ReactNode + description: ReactNode + cardTitleLeft: ReactNode +} + +const PluginMutationModal: FC = ({ + plugin, + onCancel, + mutation, + confirmButtonText, + cancelButtonText, + modelTitle, + description, + cardTitleLeft, +}: Props) => { + return ( + +
+ {description} +
+
+ +
+
+ {mutation.isPending && ( + + )} + +
+
+ ) +} + +PluginMutationModal.displayName = 'PluginMutationModal' + +export default memo(PluginMutationModal) diff --git a/web/service/use-plugins.ts b/web/service/use-plugins.ts index f9c8f0a2c2..f885efd761 100644 --- a/web/service/use-plugins.ts +++ b/web/service/use-plugins.ts @@ -41,7 +41,7 @@ export const useCheckInstalled = ({ enabled: boolean }) => { return useQuery<{ plugins: PluginDetail[] }>({ - queryKey: [NAME_SPACE, 'checkInstalled'], + queryKey: [NAME_SPACE, 'checkInstalled', pluginIds], queryFn: () => post<{ plugins: PluginDetail[] }>('/workspaces/current/plugin/list/installations/ids', { body: { plugin_ids: pluginIds, @@ -82,8 +82,9 @@ export const useInstallPackageFromMarketPlace = (options?: MutateOptions { +export const useUpdatePackageFromMarketPlace = (options?: MutateOptions) => { return useMutation({ + ...options, mutationFn: (body: object) => { return post('/workspaces/current/plugin/upgrade/marketplace', { body, From 53bb1bb937107d4269418614ac3e9e399344236a Mon Sep 17 00:00:00 2001 From: AkaraChen Date: Wed, 8 Jan 2025 14:09:35 +0800 Subject: [PATCH 13/14] fix: agent node cannot output var --- web/app/components/workflow/constants.ts | 1 + .../workflow/nodes/_base/components/variable/utils.ts | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/web/app/components/workflow/constants.ts b/web/app/components/workflow/constants.ts index 922caded51..87f1e01f56 100644 --- a/web/app/components/workflow/constants.ts +++ b/web/app/components/workflow/constants.ts @@ -404,6 +404,7 @@ export const SUPPORT_OUTPUT_VARS_NODE = [ BlockEnum.HttpRequest, BlockEnum.Tool, BlockEnum.VariableAssigner, BlockEnum.VariableAggregator, BlockEnum.QuestionClassifier, BlockEnum.ParameterExtractor, BlockEnum.Iteration, BlockEnum.DocExtractor, BlockEnum.ListFilter, + BlockEnum.Agent, ] export const LLM_OUTPUT_STRUCT: Var[] = [ diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts index 787ed890d9..6f3ec8794f 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts +++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts @@ -319,16 +319,13 @@ const formatItem = ( case BlockEnum.Agent: { const payload = data as AgentNodeType const outputs: Var[] = [] - Object.keys(payload.output_schema.properties).forEach((outputKey) => { + Object.keys(payload.output_schema?.properties || {}).forEach((outputKey) => { const output = payload.output_schema.properties[outputKey] outputs.push({ variable: outputKey, type: output.type === 'array' ? `Array[${output.items?.type.slice(0, 1).toLocaleUpperCase()}${output.items?.type.slice(1)}]` as VarType : `${output.type.slice(0, 1).toLocaleUpperCase()}${output.type.slice(1)}` as VarType, - // TODO: is this required? - // @ts-expect-error todo added - description: output.description, }) }) res.vars = [ From 98ad18ba81cbcbc0ec79749b52c0fdb4c7be54da Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Wed, 8 Jan 2025 14:19:50 +0800 Subject: [PATCH 14/14] fix: agent log --- web/app/components/plugins/card/index.tsx | 4 +-- web/app/components/plugins/hooks.ts | 28 +++++++++++++++++++ .../components/plugins/plugin-item/index.tsx | 4 +-- .../workflow/run/agent-log/agent-log-item.tsx | 10 +++---- .../workflow/run/agent-log/agent-log-nav.tsx | 5 ++-- .../run/agent-log/agent-log-trigger.tsx | 4 ++- .../workflow/run/special-result-panel.tsx | 7 +++-- .../components/workflow/run/tracing-panel.tsx | 8 +++++- web/i18n/en-US/plugin.ts | 9 +++++- web/i18n/zh-Hans/plugin.ts | 7 +++++ web/service/use-plugins.ts | 2 +- 11 files changed, 71 insertions(+), 17 deletions(-) diff --git a/web/app/components/plugins/card/index.tsx b/web/app/components/plugins/card/index.tsx index ff86a3c39c..04ef0dd1ee 100644 --- a/web/app/components/plugins/card/index.tsx +++ b/web/app/components/plugins/card/index.tsx @@ -11,7 +11,7 @@ import Placeholder from './base/placeholder' import cn from '@/utils/classnames' import { useGetLanguage } from '@/context/i18n' import { getLanguage } from '@/i18n/language' -import { useCategories } from '../hooks' +import { useSingleCategories } from '../hooks' import { renderI18nObject } from '@/hooks/use-i18n' export type Props = { @@ -43,7 +43,7 @@ const Card = ({ }: Props) => { const defaultLocale = useGetLanguage() const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale - const { categoriesMap } = useCategories() + const { categoriesMap } = useSingleCategories() const { category, type, name, org, label, brief, icon, verified } = payload const isBundle = !['plugin', 'model', 'tool', 'extension', 'agent_strategy'].includes(type) const cornerMark = isBundle ? categoriesMap.bundle?.label : categoriesMap[category]?.label diff --git a/web/app/components/plugins/hooks.ts b/web/app/components/plugins/hooks.ts index 7c3003497b..371b769019 100644 --- a/web/app/components/plugins/hooks.ts +++ b/web/app/components/plugins/hooks.ts @@ -64,3 +64,31 @@ export const useCategories = (translateFromOut?: TFunction) => { categoriesMap, } } + +export const useSingleCategories = (translateFromOut?: TFunction) => { + const { t: translation } = useTranslation() + const t = translateFromOut || translation + + const categories = categoryKeys.map((category) => { + if (category === 'agent') { + return { + name: 'agent_strategy', + label: t(`plugin.categorySingle.${category}`), + } + } + return { + name: category, + label: t(`plugin.categorySingle.${category}`), + } + }) + + const categoriesMap = categories.reduce((acc, category) => { + acc[category.name] = category + return acc + }, {} as Record) + + return { + categories, + categoriesMap, + } +} diff --git a/web/app/components/plugins/plugin-item/index.tsx b/web/app/components/plugins/plugin-item/index.tsx index ef564230ea..3dd520d39a 100644 --- a/web/app/components/plugins/plugin-item/index.tsx +++ b/web/app/components/plugins/plugin-item/index.tsx @@ -22,7 +22,7 @@ import cn from '@/utils/classnames' import { API_PREFIX, MARKETPLACE_URL_PREFIX } from '@/config' import { useInvalidateInstalledPluginList } from '@/service/use-plugins' import { useInvalidateAllBuiltInTools, useInvalidateAllToolProviders } from '@/service/use-tools' -import { useCategories } from '../hooks' +import { useSingleCategories } from '../hooks' import { useProviderContext } from '@/context/provider-context' import { useRenderI18nObject } from '@/hooks/use-i18n' @@ -36,7 +36,7 @@ const PluginItem: FC = ({ plugin, }) => { const { t } = useTranslation() - const { categoriesMap } = useCategories() + const { categoriesMap } = useSingleCategories() const currentPluginID = usePluginPageContext(v => v.currentPluginID) const setCurrentPluginID = usePluginPageContext(v => v.setCurrentPluginID) const invalidateInstalledPluginList = useInvalidateInstalledPluginList() diff --git a/web/app/components/workflow/run/agent-log/agent-log-item.tsx b/web/app/components/workflow/run/agent-log/agent-log-item.tsx index 26c734874d..8403dd68dc 100644 --- a/web/app/components/workflow/run/agent-log/agent-log-item.tsx +++ b/web/app/components/workflow/run/agent-log/agent-log-item.tsx @@ -30,26 +30,26 @@ const AgentLogItem = ({
setExpanded(!expanded)} > { expanded - ? - : + ? + : }
{label}
-
0.02s
+ {/*
0.02s
*/}
{ expanded && (
{ - !!children.length && ( + !!children?.length && ( { diff --git a/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx b/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx index 825f59f085..987c3afc2a 100644 --- a/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx +++ b/web/app/components/workflow/run/agent-log/agent-log-trigger.tsx @@ -24,7 +24,9 @@ const AgentLogTrigger = ({
onShowAgentOrToolLog({ id: nodeInfo.id, children: agentLog || [] } as AgentLogItemWithChildren)} + onClick={() => { + onShowAgentOrToolLog({ id: nodeInfo.id, children: agentLog || [] } as AgentLogItemWithChildren) + }} > Detail diff --git a/web/app/components/workflow/run/special-result-panel.tsx b/web/app/components/workflow/run/special-result-panel.tsx index 52e3786fad..cdd77894f5 100644 --- a/web/app/components/workflow/run/special-result-panel.tsx +++ b/web/app/components/workflow/run/special-result-panel.tsx @@ -36,7 +36,10 @@ const SpecialResultPanel = ({ handleShowAgentOrToolLog, }: SpecialResultPanelProps) => { return ( - <> +
{ + e.stopPropagation() + e.nativeEvent.stopImmediatePropagation() + }}> { !!showRetryDetail && !!retryResultList?.length && setShowRetryDetailFalse && ( ) } - +
) } diff --git a/web/app/components/workflow/run/tracing-panel.tsx b/web/app/components/workflow/run/tracing-panel.tsx index d65b7b73eb..758e9cfcf8 100644 --- a/web/app/components/workflow/run/tracing-panel.tsx +++ b/web/app/components/workflow/run/tracing-panel.tsx @@ -166,7 +166,13 @@ const TracingPanel: FC = ({ } return ( -
+
{ + e.stopPropagation() + e.nativeEvent.stopImmediatePropagation() + }} + > {treeNodes.map(renderNode)}
) diff --git a/web/i18n/en-US/plugin.ts b/web/i18n/en-US/plugin.ts index b5c4688818..603b403435 100644 --- a/web/i18n/en-US/plugin.ts +++ b/web/i18n/en-US/plugin.ts @@ -3,10 +3,17 @@ const translation = { all: 'All', models: 'Models', tools: 'Tools', - agents: 'Agent Strategy', + agents: 'Agent Strategies', extensions: 'Extensions', bundles: 'Bundles', }, + categorySingle: { + model: 'Model', + tool: 'Tool', + agent: 'Agent Strategy', + extension: 'Extension', + bundle: 'Bundle', + }, search: 'Search', allCategories: 'All Categories', searchCategories: 'Search Categories', diff --git a/web/i18n/zh-Hans/plugin.ts b/web/i18n/zh-Hans/plugin.ts index 951e8e10be..55d7dd81f0 100644 --- a/web/i18n/zh-Hans/plugin.ts +++ b/web/i18n/zh-Hans/plugin.ts @@ -7,6 +7,13 @@ const translation = { extensions: '扩展', bundles: '插件集', }, + categorySingle: { + model: '模型', + tool: '工具', + agent: 'Agent 策略', + extension: '扩展', + bundle: '插件集', + }, search: '搜索', allCategories: '所有类别', searchCategories: '搜索类别', diff --git a/web/service/use-plugins.ts b/web/service/use-plugins.ts index f885efd761..a33ca9af46 100644 --- a/web/service/use-plugins.ts +++ b/web/service/use-plugins.ts @@ -365,7 +365,7 @@ export const usePluginTaskList = () => { queryKey: usePluginTaskListKey, queryFn: async () => { const currentData = await get<{ tasks: PluginTask[] }>('/workspaces/current/plugin/tasks?page=1&page_size=100') - const taskDone = currentData.tasks.every(task => task.status === TaskStatus.success) + const taskDone = currentData.tasks.every(task => task.status === TaskStatus.success || task.status === TaskStatus.failed) if (taskDone) setEnabled(false)