From bc57fa06190b9dc0ffccece353498dcf606fddae Mon Sep 17 00:00:00 2001 From: kurokobo Date: Sun, 13 Apr 2025 11:21:56 +0900 Subject: [PATCH 1/4] fix: start the plugin daemon after the database has become healthy (#17928) --- docker/docker-compose-template.yaml | 7 ++++--- docker/docker-compose.yaml | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docker/docker-compose-template.yaml b/docker/docker-compose-template.yaml index ef58bf99f3..81314421a8 100644 --- a/docker/docker-compose-template.yaml +++ b/docker/docker-compose-template.yaml @@ -90,10 +90,10 @@ services: volumes: - ./volumes/db/data:/var/lib/postgresql/data healthcheck: - test: [ 'CMD', 'pg_isready' ] + test: [ 'CMD', 'pg_isready', '-h', 'db', '-U', '${PGUSER:-postgres}', '-d', '${POSTGRES_DB:-dify}' ] interval: 1s timeout: 3s - retries: 30 + retries: 60 # The redis cache. redis: @@ -175,7 +175,8 @@ services: volumes: - ./volumes/plugin_daemon:/app/storage depends_on: - - db + db: + condition: service_healthy # ssrf_proxy server # for more information, please refer to diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 305cf22b20..720b604f7f 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -558,10 +558,10 @@ services: volumes: - ./volumes/db/data:/var/lib/postgresql/data healthcheck: - test: [ 'CMD', 'pg_isready' ] + test: [ 'CMD', 'pg_isready', '-h', 'db', '-U', '${PGUSER:-postgres}', '-d', '${POSTGRES_DB:-dify}' ] interval: 1s timeout: 3s - retries: 30 + retries: 60 # The redis cache. redis: @@ -643,7 +643,8 @@ services: volumes: - ./volumes/plugin_daemon:/app/storage depends_on: - - db + db: + condition: service_healthy # ssrf_proxy server # for more information, please refer to From cf8d15e8d5baf506b7a230aea6ec25a1e3073404 Mon Sep 17 00:00:00 2001 From: CorrectRoad Date: Sun, 13 Apr 2025 10:25:34 +0800 Subject: [PATCH 2/4] fix: fix wrong layer adding customized tools (#17937) --- web/.husky/pre-commit | 0 web/app/components/base/drawer/index.tsx | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) mode change 100755 => 100644 web/.husky/pre-commit diff --git a/web/.husky/pre-commit b/web/.husky/pre-commit old mode 100755 new mode 100644 diff --git a/web/app/components/base/drawer/index.tsx b/web/app/components/base/drawer/index.tsx index 7e3405e9d2..6002112e52 100644 --- a/web/app/components/base/drawer/index.tsx +++ b/web/app/components/base/drawer/index.tsx @@ -44,17 +44,17 @@ export default function Drawer({ unmount={unmount} open={isOpen} onClose={() => !clickOutsideNotOpen && onClose()} - className="fixed inset-0 z-30 overflow-y-auto" + className="fixed inset-0 z-[80] overflow-y-auto" >
{/* mask */} { !clickOutsideNotOpen && onClose() }} /> -
+
<>
{title && Date: Sun, 13 Apr 2025 10:52:54 +0800 Subject: [PATCH 3/4] refactor & perf: improve type safety of component `PluginList` (#17498) --- .../workflow/block-selector/all-tools.tsx | 17 +++++++---- .../market-place-plugin/list.tsx | 28 +++++++++---------- .../components/agent-strategy-selector.tsx | 12 +++++--- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/web/app/components/workflow/block-selector/all-tools.tsx b/web/app/components/workflow/block-selector/all-tools.tsx index 9ba10dc84d..3ad0a41d54 100644 --- a/web/app/components/workflow/block-selector/all-tools.tsx +++ b/web/app/components/workflow/block-selector/all-tools.tsx @@ -15,7 +15,8 @@ import { useToolTabs } from './hooks' import ViewTypeSelect, { ViewType } from './view-type-select' import cn from '@/utils/classnames' import { useGetLanguage } from '@/context/i18n' -import PluginList from '@/app/components/workflow/block-selector/market-place-plugin/list' +import type { ListRef } from '@/app/components/workflow/block-selector/market-place-plugin/list' +import PluginList, { type ListProps } from '@/app/components/workflow/block-selector/market-place-plugin/list' import ActionButton from '../../base/action-button' import { RiAddLine } from '@remixicon/react' import { PluginType } from '../../plugins/types' @@ -26,7 +27,7 @@ type AllToolsProps = { className?: string toolContentClassName?: string searchText: string - tags: string[] + tags: ListProps['tags'] buildInTools: ToolWithProvider[] customTools: ToolWithProvider[] workflowTools: ToolWithProvider[] @@ -36,11 +37,14 @@ type AllToolsProps = { onShowAddCustomCollectionModal?: () => void selectedTools?: ToolValue[] } + +const DEFAULT_TAGS: AllToolsProps['tags'] = [] + const AllTools = ({ className, toolContentClassName, searchText, - tags = [], + tags = DEFAULT_TAGS, onSelect, buildInTools, workflowTools, @@ -97,7 +101,7 @@ const AllTools = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [searchText, tags, enable_marketplace]) - const pluginRef = useRef(null) + const pluginRef = useRef(null) const wrapElemRef = useRef(null) return ( @@ -136,7 +140,7 @@ const AllTools = ({
{/* Plugins from marketplace */} {enable_marketplace && list: Plugin[] searchText: string @@ -20,17 +19,16 @@ type Props = { disableMaxWidth?: boolean } -const List = ( - { - ref, - wrapElemRef, - searchText, - tags, - list, - toolContentClassName, - disableMaxWidth = false, - }, -) => { +export type ListRef = { handleScroll: () => void } + +const List = forwardRef(({ + wrapElemRef, + searchText, + tags, + list, + toolContentClassName, + disableMaxWidth = false, +}, ref) => { const { t } = useTranslation() const hasFilter = !searchText const hasRes = list.length > 0 @@ -126,7 +124,7 @@ const List = (
) -} +}) List.displayName = 'List' 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 83cea4c594..dd6a1c6a22 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 @@ -18,10 +18,13 @@ import { CollectionType } from '@/app/components/tools/types' import useGetIcon from '@/app/components/plugins/install-plugin/base/use-get-icon' 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 type { ListRef } from '@/app/components/workflow/block-selector/market-place-plugin/list' +import PluginList, { type ListProps } 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 DEFAULT_TAGS: ListProps['tags'] = [] + const NotFoundWarn = (props: { title: ReactNode, description: ReactNode @@ -138,7 +141,7 @@ export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) => // eslint-disable-next-line react-hooks/exhaustive-deps }, [query]) - const pluginRef = useRef(null) + const pluginRef = useRef(null) return @@ -213,10 +216,11 @@ export const AgentStrategySelector = memo((props: AgentStrategySelectorProps) => className='h-full max-h-full max-w-none overflow-y-auto' indexBarClassName='top-0 xl:top-36' showWorkflowEmpty={false} hasSearchText={false} /> From c9a594100bfd14c332651c78243f79f789de9640 Mon Sep 17 00:00:00 2001 From: yusheng chen Date: Sun, 13 Apr 2025 18:12:29 +0800 Subject: [PATCH 4/4] refactor & perf of files `datesets/Doc.tsx` and `template.xx.mdx` (#17951) --- web/app/(commonLayout)/datasets/Doc.tsx | 24 ++++++++++--------- .../datasets/template/template.en.mdx | 5 ++++ .../datasets/template/template.ja.mdx | 5 ++++ .../datasets/template/template.zh.mdx | 5 ++++ 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/web/app/(commonLayout)/datasets/Doc.tsx b/web/app/(commonLayout)/datasets/Doc.tsx index 57d4b8dfef..e79adbccd5 100644 --- a/web/app/(commonLayout)/datasets/Doc.tsx +++ b/web/app/(commonLayout)/datasets/Doc.tsx @@ -1,6 +1,6 @@ 'use client' -import { useEffect, useState } from 'react' +import { useEffect, useMemo, useState } from 'react' import { useContext } from 'use-context-selector' import { useTranslation } from 'react-i18next' import { RiListUnordered } from '@remixicon/react' @@ -67,6 +67,17 @@ const Doc = ({ apiBaseUrl }: DocProps) => { } } + const Template = useMemo(() => { + switch (locale) { + case LanguagesSupported[1]: + return + case LanguagesSupported[7]: + return + default: + return + } + }, [apiBaseUrl, locale]) + return (
@@ -107,16 +118,7 @@ const Doc = ({ apiBaseUrl }: DocProps) => { )}
- {(() => { - switch (locale) { - case LanguagesSupported[1]: - return - case LanguagesSupported[7]: - return - default: - return - } - })()} + {Template}
) diff --git a/web/app/(commonLayout)/datasets/template/template.en.mdx b/web/app/(commonLayout)/datasets/template/template.en.mdx index ca86c7e6d6..4faf26058e 100644 --- a/web/app/(commonLayout)/datasets/template/template.en.mdx +++ b/web/app/(commonLayout)/datasets/template/template.en.mdx @@ -1,3 +1,8 @@ +{/** + * @typedef Props + * @property {string} apiBaseUrl + */} + import { CodeGroup } from '@/app/components/develop/code.tsx' import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx' diff --git a/web/app/(commonLayout)/datasets/template/template.ja.mdx b/web/app/(commonLayout)/datasets/template/template.ja.mdx index 45f3adfc4d..a5e560df8c 100644 --- a/web/app/(commonLayout)/datasets/template/template.ja.mdx +++ b/web/app/(commonLayout)/datasets/template/template.ja.mdx @@ -1,3 +1,8 @@ +{/** + * @typedef Props + * @property {string} apiBaseUrl + */} + import { CodeGroup } from '@/app/components/develop/code.tsx' import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx' diff --git a/web/app/(commonLayout)/datasets/template/template.zh.mdx b/web/app/(commonLayout)/datasets/template/template.zh.mdx index 20511b8cf7..8ff82ca1fb 100644 --- a/web/app/(commonLayout)/datasets/template/template.zh.mdx +++ b/web/app/(commonLayout)/datasets/template/template.zh.mdx @@ -1,3 +1,8 @@ +{/** + * @typedef Props + * @property {string} apiBaseUrl + */} + import { CodeGroup } from '@/app/components/develop/code.tsx' import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstruction, Paragraph } from '@/app/components/develop/md.tsx'