feat: knowledge pipeline (#25360)
Signed-off-by: -LAN- <laipz8200@outlook.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: jyong <718720800@qq.com> Co-authored-by: Wu Tianwei <30284043+WTW0313@users.noreply.github.com> Co-authored-by: QuantumGhost <obelisk.reg+git@gmail.com> Co-authored-by: lyzno1 <yuanyouhuilyz@gmail.com> Co-authored-by: quicksand <quicksandzn@gmail.com> Co-authored-by: Jyong <76649700+JohnJyong@users.noreply.github.com> Co-authored-by: lyzno1 <92089059+lyzno1@users.noreply.github.com> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: Yongtao Huang <yongtaoh2022@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: Hanqing Zhao <sherry9277@gmail.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Harry <xh001x@hotmail.com>
This commit is contained in:
@@ -25,10 +25,10 @@ const Nav = ({
|
||||
activeSegment,
|
||||
link,
|
||||
curNav,
|
||||
navs,
|
||||
navigationItems,
|
||||
createText,
|
||||
onCreate,
|
||||
onLoadmore,
|
||||
onLoadMore,
|
||||
isApp,
|
||||
}: INavProps) => {
|
||||
const setAppDetail = useAppStore(state => state.setAppDetail)
|
||||
@@ -53,11 +53,11 @@ const Nav = ({
|
||||
<Link href={link + (linkLastSearchParams && `?${linkLastSearchParams}`)}>
|
||||
<div
|
||||
onClick={() => setAppDetail()}
|
||||
className={classNames(`
|
||||
flex h-7 cursor-pointer items-center rounded-[10px] px-2.5
|
||||
${isActivated ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text'}
|
||||
${curNav && isActivated && 'hover:bg-components-main-nav-nav-button-bg-active-hover'}
|
||||
`)}
|
||||
className={classNames(
|
||||
'flex h-7 cursor-pointer items-center rounded-[10px] px-2.5',
|
||||
isActivated ? 'text-components-main-nav-nav-button-text-active' : 'text-components-main-nav-nav-button-text',
|
||||
curNav && isActivated && 'hover:bg-components-main-nav-nav-button-bg-active-hover',
|
||||
)}
|
||||
onMouseEnter={() => setHovered(true)}
|
||||
onMouseLeave={() => setHovered(false)}
|
||||
>
|
||||
@@ -82,10 +82,10 @@ const Nav = ({
|
||||
<NavSelector
|
||||
isApp={isApp}
|
||||
curNav={curNav}
|
||||
navs={navs}
|
||||
navigationItems={navigationItems}
|
||||
createText={createText}
|
||||
onCreate={onCreate}
|
||||
onLoadmore={onLoadmore}
|
||||
onLoadMore={onLoadMore}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -24,31 +24,31 @@ export type NavItem = {
|
||||
link: string
|
||||
icon_type: AppIconType | null
|
||||
icon: string
|
||||
icon_background: string
|
||||
icon_background: string | null
|
||||
icon_url: string | null
|
||||
mode?: string
|
||||
}
|
||||
export type INavSelectorProps = {
|
||||
navs: NavItem[]
|
||||
navigationItems: NavItem[]
|
||||
curNav?: Omit<NavItem, 'link'>
|
||||
createText: string
|
||||
isApp?: boolean
|
||||
onCreate: (state: string) => void
|
||||
onLoadmore?: () => void
|
||||
onLoadMore?: () => void
|
||||
}
|
||||
|
||||
const NavSelector = ({ curNav, navs, createText, isApp, onCreate, onLoadmore }: INavSelectorProps) => {
|
||||
const NavSelector = ({ curNav, navigationItems, createText, isApp, onCreate, onLoadMore }: INavSelectorProps) => {
|
||||
const { t } = useTranslation()
|
||||
const router = useRouter()
|
||||
const { isCurrentWorkspaceEditor } = useAppContext()
|
||||
const setAppDetail = useAppStore(state => state.setAppDetail)
|
||||
|
||||
const handleScroll = useCallback(debounce((e) => {
|
||||
if (typeof onLoadmore === 'function') {
|
||||
if (typeof onLoadMore === 'function') {
|
||||
const { clientHeight, scrollHeight, scrollTop } = e.target
|
||||
|
||||
if (clientHeight + scrollTop > scrollHeight - 50)
|
||||
onLoadmore()
|
||||
onLoadMore()
|
||||
}
|
||||
}, 50), [])
|
||||
|
||||
@@ -75,7 +75,7 @@ const NavSelector = ({ curNav, navs, createText, isApp, onCreate, onLoadmore }:
|
||||
>
|
||||
<div className="overflow-auto px-1 py-1" style={{ maxHeight: '50vh' }} onScroll={handleScroll}>
|
||||
{
|
||||
navs.map(nav => (
|
||||
navigationItems.map(nav => (
|
||||
<MenuItem key={nav.id}>
|
||||
<div className='flex w-full cursor-pointer items-center truncate rounded-lg px-3 py-[6px] text-[14px] font-normal text-text-secondary hover:bg-state-base-hover' onClick={() => {
|
||||
if (curNav?.id === nav.id)
|
||||
@@ -84,7 +84,13 @@ const NavSelector = ({ curNav, navs, createText, isApp, onCreate, onLoadmore }:
|
||||
router.push(nav.link)
|
||||
}} title={nav.name}>
|
||||
<div className='relative mr-2 h-6 w-6 rounded-md'>
|
||||
<AppIcon size='tiny' iconType={nav.icon_type} icon={nav.icon} background={nav.icon_background} imageUrl={nav.icon_url} />
|
||||
<AppIcon
|
||||
size='tiny'
|
||||
iconType={nav.icon_type}
|
||||
icon={nav.icon}
|
||||
background={nav.icon_background}
|
||||
imageUrl={nav.icon_url}
|
||||
/>
|
||||
{!!nav.mode && (
|
||||
<span className={cn(
|
||||
'absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded border-[0.5px] border-[rgba(0,0,0,0.02)] bg-white p-0.5 shadow-sm',
|
||||
|
||||
Reference in New Issue
Block a user