Merge remote-tracking branch 'origin/main'

pull/17026/head
Silow9 1 year ago
commit 46c4bede79

@ -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

@ -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

@ -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 <TemplateZh apiBaseUrl={apiBaseUrl} />
case LanguagesSupported[7]:
return <TemplateJa apiBaseUrl={apiBaseUrl} />
default:
return <TemplateEn apiBaseUrl={apiBaseUrl} />
}
}, [apiBaseUrl, locale])
return (
<div className="flex">
<div className={`fixed right-20 top-32 z-10 transition-all ${isTocExpanded ? 'w-64' : 'w-10'}`}>
@ -107,16 +118,7 @@ const Doc = ({ apiBaseUrl }: DocProps) => {
)}
</div>
<article className='prose-xl prose mx-1 rounded-t-xl bg-white px-4 pt-16 sm:mx-12'>
{(() => {
switch (locale) {
case LanguagesSupported[1]:
return <TemplateZh apiBaseUrl={apiBaseUrl} />
case LanguagesSupported[7]:
return <TemplateJa apiBaseUrl={apiBaseUrl} />
default:
return <TemplateEn apiBaseUrl={apiBaseUrl} />
}
})()}
{Template}
</article>
</div>
)

@ -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'

@ -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'

@ -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'

@ -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"
>
<div className={cn('flex h-screen w-screen justify-end', positionCenter && '!justify-center')}>
{/* mask */}
<DialogBackdrop
className={cn('fixed inset-0 z-40', mask && 'bg-black bg-opacity-30')}
className={cn('fixed inset-0 z-[90]', mask && 'bg-black bg-opacity-30')}
onClick={() => {
!clickOutsideNotOpen && onClose()
}}
/>
<div className={cn('relative z-50 flex w-full max-w-sm flex-col justify-between overflow-hidden bg-components-panel-bg p-6 text-left align-middle shadow-xl', panelClassname)}>
<div className={cn('relative z-[100] flex w-full max-w-sm flex-col justify-between overflow-hidden bg-components-panel-bg p-6 text-left align-middle shadow-xl', panelClassname)}>
<>
<div className='flex justify-between'>
{title && <DialogTitle

@ -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<ListRef>(null)
const wrapElemRef = useRef<HTMLDivElement>(null)
return (
@ -136,7 +140,7 @@ const AllTools = ({
<div
ref={wrapElemRef}
className='max-h-[464px] overflow-y-auto'
onScroll={(pluginRef.current as any)?.handleScroll}
onScroll={pluginRef.current?.handleScroll}
>
<Tools
className={toolContentClassName}
@ -149,8 +153,9 @@ const AllTools = ({
/>
{/* Plugins from marketplace */}
{enable_marketplace && <PluginList
ref={pluginRef}
wrapElemRef={wrapElemRef}
list={notInstalledPlugins as any} ref={pluginRef}
list={notInstalledPlugins}
searchText={searchText}
toolContentClassName={toolContentClassName}
tags={tags}

@ -1,5 +1,5 @@
'use client'
import React, { useEffect, useImperativeHandle, useMemo, useRef } from 'react'
import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import useStickyScroll, { ScrollPosition } from '../use-sticky-scroll'
import Item from './item'
@ -8,10 +8,9 @@ import cn from '@/utils/classnames'
import Link from 'next/link'
import { marketplaceUrlPrefix } from '@/config'
import { RiArrowRightUpLine, RiSearchLine } from '@remixicon/react'
// import { RiArrowRightUpLine } from '@remixicon/react'
import { noop } from 'lodash-es'
type Props = {
export type ListProps = {
wrapElemRef: React.RefObject<HTMLElement>
list: Plugin[]
searchText: string
@ -20,17 +19,16 @@ type Props = {
disableMaxWidth?: boolean
}
const List = (
{
ref,
export type ListRef = { handleScroll: () => void }
const List = forwardRef<ListRef, ListProps>(({
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 = (
</div>
</>
)
}
})
List.displayName = 'List'

@ -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<ListRef>(null)
return <PortalToFollowElem open={open} onOpenChange={setOpen} placement='bottom'>
<PortalToFollowElemTrigger className='w-full'>
@ -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} />
<PluginList
ref={pluginRef}
wrapElemRef={wrapElemRef}
list={notInstalledPlugins as any} ref={pluginRef}
list={notInstalledPlugins}
searchText={query}
tags={[]}
tags={DEFAULT_TAGS}
disableMaxWidth
/>
</main>

Loading…
Cancel
Save