From 369e3eb97fafa5779c4468f2886a65e1391f4f51 Mon Sep 17 00:00:00 2001 From: Yi Date: Wed, 8 Jan 2025 16:39:56 +0800 Subject: [PATCH 1/4] feat: add version switch in model selector --- .../model-parameter-modal/agent-model-trigger.tsx | 4 ++-- .../model-parameter-modal/status-indicators.tsx | 10 +++++++--- .../nodes/_base/components/switch-plugin-version.tsx | 2 +- web/i18n/en-US/workflow.ts | 1 + web/i18n/zh-Hans/workflow.ts | 1 + 5 files changed, 12 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 068be5bbf3..be56b95a95 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 @@ -83,7 +83,7 @@ const AgentModelTrigger: FC = ({ // pass } } - if (providerName && !modelProvider) { + if (providerName) { const parts = providerName.split('/') const org = parts[0] const name = parts[1] @@ -101,7 +101,7 @@ const AgentModelTrigger: FC = ({ setIsPluginChecked(true) } })() - }, [providerName, modelProvider, modelId, currentProvider]) + }, [providerName, modelId, currentProvider]) if (modelId && !isPluginChecked) return null diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/status-indicators.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/status-indicators.tsx index d5bda7caf6..1c28ef3019 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/status-indicators.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/status-indicators.tsx @@ -1,5 +1,7 @@ import Tooltip from '@/app/components/base/tooltip' import Link from 'next/link' +import { SwitchPluginVersion } from '@/app/components/workflow/nodes/_base/components/switch-plugin-version' +import { useInstalledPluginList } from '@/service/use-plugins' import { RiErrorWarningFill } from '@remixicon/react' type StatusIndicatorsProps = { @@ -12,9 +14,10 @@ type StatusIndicatorsProps = { } const StatusIndicators = ({ needsConfiguration, modelProvider, inModelList, disabled, pluginInfo, t }: StatusIndicatorsProps) => { + const { data: pluginList } = useInstalledPluginList() const renderTooltipContent = (title: string, description?: string, linkText?: string, linkHref?: string) => { return ( -
+
e.stopPropagation()}>
{title}
{description && (
@@ -36,6 +39,7 @@ const StatusIndicators = ({ needsConfiguration, modelProvider, inModelList, disa
) } + // const installedPluginUniqueIdentifier = pluginList?.plugins.find(plugin => plugin.name === pluginInfo.name)?.plugin_unique_identifier return ( <> {/* plugin installed and model is in model list but disabled */} @@ -45,7 +49,7 @@ const StatusIndicators = ({ needsConfiguration, modelProvider, inModelList, disa popupContent={inModelList ? t('workflow.nodes.agent.modelSelectorTooltips.deprecated') : renderTooltipContent( t('workflow.nodes.agent.modelNotSupport.title'), - t('workflow.nodes.agent.modelNotSupport.desc'), + !pluginInfo ? t('workflow.nodes.agent.modelNotSupport.desc') : t('workflow.nodes.agent.modelNotSupport.descForVersionSwitch'), !pluginInfo ? t('workflow.nodes.agent.linkToPlugin') : '', !pluginInfo ? '/plugins' : '', ) @@ -53,7 +57,7 @@ const StatusIndicators = ({ needsConfiguration, modelProvider, inModelList, disa asChild={false} needsDelay={!inModelList} > - + {!pluginInfo ? : plugin.name === pluginInfo.name)?.plugin_unique_identifier ?? ''} />} )} {!modelProvider && !pluginInfo && ( 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 05a673ee2b..2eee37c5c5 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 @@ -61,7 +61,7 @@ export const SwitchPluginVersion: FC = (props) => { } const { t } = useTranslation() return -
+
{isShowUpdateModal && pluginDetail && Date: Wed, 8 Jan 2025 16:41:16 +0800 Subject: [PATCH 2/4] feat: add 'agent' tag to plugin constants and translations --- web/app/components/plugins/constants.ts | 1 + web/i18n/en-US/plugin-tags.ts | 1 + web/i18n/zh-Hans/plugin-tags.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/web/app/components/plugins/constants.ts b/web/app/components/plugins/constants.ts index c43a1ae946..40a3f0da83 100644 --- a/web/app/components/plugins/constants.ts +++ b/web/app/components/plugins/constants.ts @@ -1,4 +1,5 @@ export const tagKeys = [ + 'agent', 'search', 'image', 'videos', diff --git a/web/i18n/en-US/plugin-tags.ts b/web/i18n/en-US/plugin-tags.ts index e96f415053..d2177b2848 100644 --- a/web/i18n/en-US/plugin-tags.ts +++ b/web/i18n/en-US/plugin-tags.ts @@ -2,6 +2,7 @@ const translation = { allTags: 'All Tags', searchTags: 'Search Tags', tags: { + agent: 'Agent', search: 'Search', image: 'Image', videos: 'Videos', diff --git a/web/i18n/zh-Hans/plugin-tags.ts b/web/i18n/zh-Hans/plugin-tags.ts index 4c9b2c6370..c133992b38 100644 --- a/web/i18n/zh-Hans/plugin-tags.ts +++ b/web/i18n/zh-Hans/plugin-tags.ts @@ -2,6 +2,7 @@ const translation = { allTags: '所有标签', searchTags: '搜索标签', tags: { + agent: 'Agent', search: '搜索', image: '图片', videos: '视频', From 586f9d8d891c17efe2e1958a97abf2762f9c59f9 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Wed, 8 Jan 2025 16:46:07 +0800 Subject: [PATCH 3/4] fix: agent log --- .../workflow/run/agent-log/agent-log-item.tsx | 2 +- .../workflow/run/agent-log/agent-log-nav.tsx | 55 +++++++++++++------ .../run/agent-log/agent-log-trigger.tsx | 6 +- .../run/agent-log/agent-result-panel.tsx | 10 ++-- web/i18n/en-US/run-log.ts | 2 + web/i18n/zh-Hans/run-log.ts | 2 + 6 files changed, 53 insertions(+), 24 deletions(-) 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 8403dd68dc..36b1d78bc6 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 @@ -27,7 +27,7 @@ const AgentLogItem = ({ const [expanded, setExpanded] = useState(false) return ( -
+
{ - const options = agentOrToolLogItemStack.slice(2) + const { t } = useTranslation() + const agentOrToolLogItemStackLength = agentOrToolLogItemStack.length + const first = agentOrToolLogItemStack[0] + const mid = agentOrToolLogItemStack.slice(1, -1) + const end = agentOrToolLogItemStack.at(-1) return ( -
+
/
- { - !!options.length && ( + agentOrToolLogItemStackLength > 1 + ? ( + + ) + : ( +
+ {t('workflow.nodes.agent.strategy.label')} +
+ ) + } + { + !!mid.length && ( <>
/
) } -
/
-
- Run Actions -
+ { + !!end && agentOrToolLogItemStackLength > 2 && ( + <> +
/
+
+ {end.label} +
+ + ) + }
) } 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 987c3afc2a..589624f559 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 @@ -1,4 +1,5 @@ import { RiArrowRightLine } from '@remixicon/react' +import { useTranslation } from 'react-i18next' import type { AgentLogItemWithChildren, NodeTracing, @@ -12,12 +13,13 @@ const AgentLogTrigger = ({ nodeInfo, onShowAgentOrToolLog, }: AgentLogTriggerProps) => { + const { t } = useTranslation() const { agentLog } = nodeInfo return (
- Agent strategy + {t('workflow.nodes.agent.strategy.label')}
@@ -28,7 +30,7 @@ const AgentLogTrigger = ({ onShowAgentOrToolLog({ id: nodeInfo.id, children: agentLog || [] } as AgentLogItemWithChildren) }} > - Detail + {t('runLog.detail')}
diff --git a/web/app/components/workflow/run/agent-log/agent-result-panel.tsx b/web/app/components/workflow/run/agent-log/agent-result-panel.tsx index d02e69f8da..e2d2b24966 100644 --- a/web/app/components/workflow/run/agent-log/agent-result-panel.tsx +++ b/web/app/components/workflow/run/agent-log/agent-result-panel.tsx @@ -1,4 +1,5 @@ import { RiAlertFill } from '@remixicon/react' +import { useTranslation } from 'react-i18next' import AgentLogItem from './agent-log-item' import AgentLogNav from './agent-log-nav' import type { AgentLogItemWithChildren } from '@/types/workflow' @@ -13,17 +14,18 @@ const AgentResultPanel = ({ agentOrToolLogListMap, onShowAgentOrToolLog, }: AgentResultPanelProps) => { + const { t } = useTranslation() const top = agentOrToolLogItemStack[agentOrToolLogItemStack.length - 1] const list = agentOrToolLogListMap[top.id] return ( -
+
{ -
+
{ list.map(item => ( +
- There is circular invocation of tools/nodes in the current workflow. + {t('runLog.circularInvocationTip')}
) diff --git a/web/i18n/en-US/run-log.ts b/web/i18n/en-US/run-log.ts index 33fe5c1735..3c851f4548 100644 --- a/web/i18n/en-US/run-log.ts +++ b/web/i18n/en-US/run-log.ts @@ -24,6 +24,8 @@ const translation = { link: 'detail panel', tipRight: ' view it.', }, + actionLogs: 'Action Logs', + circularInvocationTip: 'There is circular invocation of tools/nodes in the current workflow.', } export default translation diff --git a/web/i18n/zh-Hans/run-log.ts b/web/i18n/zh-Hans/run-log.ts index 225874d827..dc93e9aeb0 100644 --- a/web/i18n/zh-Hans/run-log.ts +++ b/web/i18n/zh-Hans/run-log.ts @@ -24,6 +24,8 @@ const translation = { link: '详细信息面板', tipRight: '查看它。', }, + actionLogs: 'Action 日志', + circularInvocationTip: '当前工作流中存在工具/节点的循环调用。', } export default translation From 87d7df3ed41193dfdb57fc72ef3ee90e34fa06dc Mon Sep 17 00:00:00 2001 From: Yi Date: Wed, 8 Jan 2025 16:51:06 +0800 Subject: [PATCH 4/4] fix: make the status indicator component compatible with the switch plugin version component --- .../status-indicators.tsx | 46 +++++++++++++------ .../components/switch-plugin-version.tsx | 2 +- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/status-indicators.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/status-indicators.tsx index 1c28ef3019..9f3543a475 100644 --- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/status-indicators.tsx +++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/status-indicators.tsx @@ -45,20 +45,38 @@ const StatusIndicators = ({ needsConfiguration, modelProvider, inModelList, disa {/* plugin installed and model is in model list but disabled */} {/* plugin installed from github/local and model is not in model list */} {!needsConfiguration && modelProvider && disabled && ( - - {!pluginInfo ? : plugin.name === pluginInfo.name)?.plugin_unique_identifier ?? ''} />} - + <> + {inModelList ? ( + + + + ) : !pluginInfo ? ( + + + + ) : ( + plugin.name === pluginInfo.name)?.plugin_unique_identifier ?? ''} + /> + )} + )} {!modelProvider && !pluginInfo && ( = (props) => { } const { t } = useTranslation() return -
+
e.stopPropagation()}> {isShowUpdateModal && pluginDetail &&