diff --git a/web/app/components/plugins/readme-panel/entrance.tsx b/web/app/components/plugins/readme-panel/entrance.tsx index 132328e04d..331b63bff1 100644 --- a/web/app/components/plugins/readme-panel/entrance.tsx +++ b/web/app/components/plugins/readme-panel/entrance.tsx @@ -10,11 +10,13 @@ export const ReadmeEntrance = ({ pluginDetail, showType = ReadmeShowType.drawer, className, + position = 'left', showShortTip = false, }: { pluginDetail: PluginDetail showType?: ReadmeShowType className?: string + position?: 'left' | 'right' showShortTip?: boolean }) => { const { t } = useTranslation() @@ -22,7 +24,7 @@ export const ReadmeEntrance = ({ const handleReadmeClick = () => { if (pluginDetail) - setCurrentPluginDetail(pluginDetail, showType) + setCurrentPluginDetail(pluginDetail, showType, position) } if (!pluginDetail || !pluginDetail?.plugin_unique_identifier || BUILTIN_TOOLS_ARRAY.includes(pluginDetail.id)) return null diff --git a/web/app/components/plugins/readme-panel/index.tsx b/web/app/components/plugins/readme-panel/index.tsx index 73e12b40eb..7cd1991322 100644 --- a/web/app/components/plugins/readme-panel/index.tsx +++ b/web/app/components/plugins/readme-panel/index.tsx @@ -14,7 +14,7 @@ import { ReadmeShowType, useReadmePanelStore } from './store' const ReadmePanel: FC = () => { const { currentPluginDetail, setCurrentPluginDetail } = useReadmePanelStore() - const { detail, showType } = currentPluginDetail || {} + const { detail, showType, position } = currentPluginDetail || {} const { t } = useTranslation() const language = useLanguage() @@ -87,7 +87,7 @@ const ReadmePanel: FC = () => { const portalContent = showType === ReadmeShowType.drawer ? ( -
+
void + setCurrentPluginDetail: (detail?: PluginDetail, showType?: ReadmeShowType, position?: 'left' | 'right') => void } export const useReadmePanelStore = create(set => ({ currentPluginDetail: undefined, - setCurrentPluginDetail: (detail?: PluginDetail, showType?: ReadmeShowType) => set({ + setCurrentPluginDetail: (detail?: PluginDetail, showType?: ReadmeShowType, position?: 'left' | 'right') => set({ currentPluginDetail: !detail ? undefined : { detail, showType: showType ?? ReadmeShowType.drawer, + position, }, }), })) diff --git a/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/component.tsx b/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/component.tsx index 90b51a82c7..6977f17644 100644 --- a/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/component.tsx +++ b/web/app/components/workflow/skill/editor/skill-editor/plugins/tool-block/component.tsx @@ -1,15 +1,20 @@ import type { FC } from 'react' +import type { PluginDetail } from '@/app/components/plugins/types' import type { Emoji } from '@/app/components/tools/types' import type { ToolValue } from '@/app/components/workflow/block-selector/types' import type { ToolWithProvider } from '@/app/components/workflow/types' import * as React from 'react' import { useEffect, useMemo, useState } from 'react' import { createPortal } from 'react-dom' +import { useTranslation } from 'react-i18next' import AppIcon from '@/app/components/base/app-icon' +import { InfoCircle } from '@/app/components/base/icons/src/vender/line/general' import Modal from '@/app/components/base/modal' import { useSelectOrDelete } from '@/app/components/base/prompt-editor/hooks' import { FormTypeEnum } from '@/app/components/header/account-setting/model-provider-page/declarations' import ToolAuthorizationSection from '@/app/components/plugins/plugin-detail-panel/tool-selector/sections/tool-authorization-section' +import { ReadmeEntrance } from '@/app/components/plugins/readme-panel/entrance' +import { ReadmeShowType } from '@/app/components/plugins/readme-panel/store' import { CollectionType } from '@/app/components/tools/types' import { generateFormValue, toolParametersToFormSchemas } from '@/app/components/tools/utils/to-form-schema' import { VarKindType } from '@/app/components/workflow/nodes/_base/types' @@ -103,6 +108,7 @@ const ToolBlockComponent: FC = ({ }) => { const [ref, isSelected] = useSelectOrDelete(nodeKey, DELETE_TOOL_BLOCK_COMMAND) const language = useGetLanguage() + const { t } = useTranslation() const { theme } = useTheme() const toolBlockContext = useToolBlockContext() const isUsingExternalMetadata = Boolean(toolBlockContext?.onMetadataChange) @@ -396,11 +402,16 @@ const ToolBlockComponent: FC = ({ } const needAuthorization = useMemo(() => { - return !(!currentProvider || currentProvider.type !== CollectionType.builtIn || !currentProvider.allow_delete) + return !currentProvider?.is_team_authorization + }, [currentProvider]) + const readmeEntrance = useMemo(() => { + if (!currentProvider) + return null + return }, [currentProvider]) const toolSettingsContent = currentProvider && currentTool && toolValue && ( - <> +
= ({ description={toolDescriptionText} onClose={() => setIsSettingOpen(false)} /> + + {needAuthorization && ( - <> - - +
+
+ +
+
+ {t('skillEditor.authorizationRequired', { ns: 'workflow' })} +
+
)} - {!needAuthorization && ( - - )} - + + {readmeEntrance} +
) return ( diff --git a/web/i18n/en-US/workflow.json b/web/i18n/en-US/workflow.json index 703eb7ffad..4195f2ccb2 100644 --- a/web/i18n/en-US/workflow.json +++ b/web/i18n/en-US/workflow.json @@ -1031,6 +1031,7 @@ "singleRun.testRun": "Test Run", "singleRun.testRunIteration": "Test Run Iteration", "singleRun.testRunLoop": "Test Run Loop", + "skillEditor.authorizationRequired": "Authorization required before use.", "skillEditor.previewUnavailable": "Preview unavailable", "skillEditor.referenceFiles": "Reference files", "skillEditor.unsupportedPreview": "This file type is not supported for preview", diff --git a/web/i18n/zh-Hans/workflow.json b/web/i18n/zh-Hans/workflow.json index c778367baa..0b67d3378f 100644 --- a/web/i18n/zh-Hans/workflow.json +++ b/web/i18n/zh-Hans/workflow.json @@ -1023,6 +1023,7 @@ "singleRun.testRun": "测试运行", "singleRun.testRunIteration": "测试运行迭代", "singleRun.testRunLoop": "测试运行循环", + "skillEditor.authorizationRequired": "使用前需要授权。", "skillEditor.previewUnavailable": "无法预览", "skillEditor.referenceFiles": "引用文件", "skillEditor.unsupportedPreview": "该文件类型不支持预览",