From 3f0b35d72e627957a847c0cbb3ca36e4d985ef74 Mon Sep 17 00:00:00 2001 From: Joel Date: Thu, 21 Nov 2024 18:21:57 +0800 Subject: [PATCH 1/5] feat: install bundle from marketplace code --- .../install-from-marketplace/index.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx index 553c30f6be..44b63cf7dd 100644 --- a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx @@ -2,7 +2,7 @@ import React, { useCallback, useState } from 'react' import Modal from '@/app/components/base/modal' -import type { Plugin, PluginManifestInMarket } from '../../types' +import type { Dependency, Plugin, PluginManifestInMarket } from '../../types' import { InstallStep, PluginType } from '../../types' import Install from './steps/install' import Installed from '../base/installed' @@ -10,12 +10,15 @@ import { useTranslation } from 'react-i18next' import { useUpdateModelProviders } from '@/app/components/header/account-setting/model-provider-page/hooks' import { useInvalidateInstalledPluginList } from '@/service/use-plugins' import { useInvalidateAllToolProviders } from '@/service/use-tools' +import ReadyToInstallBundle from '../install-bundle/ready-to-install' const i18nPrefix = 'plugin.installModal' type InstallFromMarketplaceProps = { uniqueIdentifier: string manifest: PluginManifestInMarket | Plugin + isBundle?: boolean + dependencies?: Dependency[] onSuccess: () => void onClose: () => void } @@ -23,6 +26,8 @@ type InstallFromMarketplaceProps = { const InstallFromMarketplace: React.FC = ({ uniqueIdentifier, manifest, + isBundle, + dependencies, onSuccess, onClose, }) => { @@ -83,7 +88,14 @@ const InstallFromMarketplace: React.FC = ({ ) } { - ([InstallStep.installed, InstallStep.installFailed].includes(step)) && ( + isBundle ? ( + + ) : ([InstallStep.installed, InstallStep.installFailed].includes(step)) && ( Date: Fri, 22 Nov 2024 09:09:22 +0800 Subject: [PATCH 2/5] fix: corner mark --- web/app/components/plugins/card/index.tsx | 9 +++++---- web/app/components/plugins/types.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/web/app/components/plugins/card/index.tsx b/web/app/components/plugins/card/index.tsx index b262727506..2d66e1b872 100644 --- a/web/app/components/plugins/card/index.tsx +++ b/web/app/components/plugins/card/index.tsx @@ -11,6 +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' export type Props = { className?: string @@ -41,9 +42,9 @@ const Card = ({ }: Props) => { const defaultLocale = useGetLanguage() const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale - - const { type, name, org, label, brief, icon, verified } = payload - + const { categoriesMap } = useCategories() + const { type, category, name, org, label, brief, icon, verified } = payload + const cornerMark = type !== 'plugin' ? type : categoriesMap[category].label const getLocalizedText = (obj: Record | undefined) => obj?.[locale] || obj?.['en-US'] || obj?.en_US || '' @@ -59,7 +60,7 @@ const Card = ({ return (
- {!hideCornerMark && } + {!hideCornerMark && } {/* Header */}
diff --git a/web/app/components/plugins/types.ts b/web/app/components/plugins/types.ts index 4bf4f54c66..b300b6b6e4 100644 --- a/web/app/components/plugins/types.ts +++ b/web/app/components/plugins/types.ts @@ -107,7 +107,7 @@ export type PluginDetail = { } export type Plugin = { - type: PluginType + type: 'plugin' | 'bundle' org: string name: string plugin_id: string From 51e04b45ec47eca2674f878fd0a533fb6dab2212 Mon Sep 17 00:00:00 2001 From: twwu Date: Fri, 22 Nov 2024 10:22:33 +0800 Subject: [PATCH 3/5] fix: update error icon z-index and upgrade react-query dependencies --- .../plugin-page/plugin-tasks/index.tsx | 2 +- web/pnpm-lock.yaml | 35 +++++++++---------- 2 files changed, 17 insertions(+), 20 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 e7fd8ad4ec..7071da0af4 100644 --- a/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx +++ b/web/app/components/plugins/plugin-page/plugin-tasks/index.tsx @@ -131,7 +131,7 @@ const PluginTasks = () => { className='flex items-center p-1 pl-2 h-8 rounded-lg hover:bg-state-base-hover' >
- + =3.0.0 || insiders || >=4.0.0-alpha.20' - '@tanstack/query-core@5.59.20': - resolution: {integrity: sha512-e8vw0lf7KwfGe1if4uPFhvZRWULqHjFcz3K8AebtieXvnMOz5FSzlZe3mTLlPuUBcydCnBRqYs2YJ5ys68wwLg==} + '@tanstack/query-core@5.60.6': + resolution: {integrity: sha512-tI+k0KyCo1EBJ54vxK1kY24LWj673ujTydCZmzEZKAew4NqZzTaVQJEuaG1qKj2M03kUHN46rchLRd+TxVq/zQ==} '@tanstack/query-devtools@5.59.20': resolution: {integrity: sha512-vxhuQ+8VV4YWQSFxQLsuM+dnEKRY7VeRzpNabFXdhEwsBYLrjXlF1pM38A8WyKNLqZy8JjyRO8oP4Wd/oKHwuQ==} - '@tanstack/react-query-devtools@5.59.20': - resolution: {integrity: sha512-AL/eQS1NFZhwwzq2Bq9Gd8wTTH+XhPNOJlDFpzPMu9NC5CQVgA0J8lWrte/sXpdWNo5KA4hgHnEdImZsF4h6Lw==} + '@tanstack/react-query-devtools@5.61.0': + resolution: {integrity: sha512-hd3yXl+KV+OGQmAw946qHAFp6DygcXcYN+1ai9idYddx6uEQyCwYk3jyIBOQEUw9uzN5DOGJLBsgd/QcimDQsA==} peerDependencies: - '@tanstack/react-query': ^5.59.20 + '@tanstack/react-query': ^5.61.0 react: ^18 || ^19 - '@tanstack/react-query@5.59.20': - resolution: {integrity: sha512-Zly0egsK0tFdfSbh5/mapSa+Zfc3Et0Zkar7Wo5sQkFzWyB3p3uZWOHR2wrlAEEV2L953eLuDBtbgFvMYiLvUw==} + '@tanstack/react-query@5.61.0': + resolution: {integrity: sha512-SBzV27XAeCRBOQ8QcC94w2H1Md0+LI0gTWwc3qRJoaGuewKn5FNW4LSqwPFJZVEItfhMfGT7RpZuSFXjTi12pQ==} peerDependencies: react: ^18 || ^19 @@ -10674,19 +10671,19 @@ snapshots: postcss-selector-parser: 6.0.10 tailwindcss: 3.4.14(ts-node@10.9.2(@types/node@18.15.0)(typescript@4.9.5)) - '@tanstack/query-core@5.59.20': {} + '@tanstack/query-core@5.60.6': {} '@tanstack/query-devtools@5.59.20': {} - '@tanstack/react-query-devtools@5.59.20(@tanstack/react-query@5.59.20(react@18.2.0))(react@18.2.0)': + '@tanstack/react-query-devtools@5.61.0(@tanstack/react-query@5.61.0(react@18.2.0))(react@18.2.0)': dependencies: '@tanstack/query-devtools': 5.59.20 - '@tanstack/react-query': 5.59.20(react@18.2.0) + '@tanstack/react-query': 5.61.0(react@18.2.0) react: 18.2.0 - '@tanstack/react-query@5.59.20(react@18.2.0)': + '@tanstack/react-query@5.61.0(react@18.2.0)': dependencies: - '@tanstack/query-core': 5.59.20 + '@tanstack/query-core': 5.60.6 react: 18.2.0 '@tanstack/react-virtual@3.10.8(react-dom@18.2.0(react@18.2.0))(react@18.2.0)': From 786f2d9bf64b560f2b9168d8e20ee78d429f0eac Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 22 Nov 2024 10:39:22 +0800 Subject: [PATCH 4/5] chore: fix categoriesMap[category] undefined --- web/app/components/plugins/card/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/components/plugins/card/index.tsx b/web/app/components/plugins/card/index.tsx index 2d66e1b872..0d4cae9e89 100644 --- a/web/app/components/plugins/card/index.tsx +++ b/web/app/components/plugins/card/index.tsx @@ -44,7 +44,7 @@ const Card = ({ const locale = localeFromProps ? getLanguage(localeFromProps) : defaultLocale const { categoriesMap } = useCategories() const { type, category, name, org, label, brief, icon, verified } = payload - const cornerMark = type !== 'plugin' ? type : categoriesMap[category].label + const cornerMark = type !== 'plugin' ? type : categoriesMap[category]?.label const getLocalizedText = (obj: Record | undefined) => obj?.[locale] || obj?.['en-US'] || obj?.en_US || '' From 3e3ae989f0093773246a3186e9ba2f21b67f4fec Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 22 Nov 2024 10:54:22 +0800 Subject: [PATCH 5/5] chore: in tool file and files all support file and files --- .../nodes/tool/components/input-var-list.tsx | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/web/app/components/workflow/nodes/tool/components/input-var-list.tsx b/web/app/components/workflow/nodes/tool/components/input-var-list.tsx index 10c534509c..722ef1ccc2 100644 --- a/web/app/components/workflow/nodes/tool/components/input-var-list.tsx +++ b/web/app/components/workflow/nodes/tool/components/input-var-list.tsx @@ -46,9 +46,7 @@ const InputVarList: FC = ({ const paramType = (type: string) => { if (type === FormTypeEnum.textNumber) return 'Number' - else if (type === FormTypeEnum.file) - return 'File' - else if (type === FormTypeEnum.files) + else if (type === FormTypeEnum.file || type === FormTypeEnum.files) return 'Files' else if (type === FormTypeEnum.select) return 'Options' @@ -141,9 +139,8 @@ const InputVarList: FC = ({ const varInput = value[variable] const isNumber = type === FormTypeEnum.textNumber const isSelect = type === FormTypeEnum.select - const isFile = type === FormTypeEnum.file - const isFileArray = type === FormTypeEnum.files - const isString = !isNumber && !isSelect && !isFile && !isFileArray + const isFile = type === FormTypeEnum.file || type === FormTypeEnum.files + const isString = !isNumber && !isSelect && !isFile return (
@@ -188,19 +185,7 @@ const InputVarList: FC = ({ onChange={handleFileChange(variable)} onOpen={handleOpen(index)} defaultVarKindType={VarKindType.variable} - filterVar={(varPayload: Var) => varPayload.type === VarType.file} - /> - )} - {isFileArray && ( - varPayload.type === VarType.arrayFile} + filterVar={(varPayload: Var) => varPayload.type === VarType.file || varPayload.type === VarType.arrayFile} /> )} {tooltip &&
{tooltip[language] || tooltip.en_US}
}