mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-06 01:16:04 +08:00
right header
This commit is contained in:
parent
9ef2c1a64c
commit
b27f98995a
@ -1,4 +1,5 @@
|
|||||||
// import { useState } from 'react'
|
// import { useState } from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
import {
|
import {
|
||||||
RiArrowGoBackLine,
|
RiArrowGoBackLine,
|
||||||
RiCloseLine,
|
RiCloseLine,
|
||||||
@ -6,22 +7,52 @@ import {
|
|||||||
} from '@remixicon/react'
|
} from '@remixicon/react'
|
||||||
import { useStore } from '../store'
|
import { useStore } from '../store'
|
||||||
import { BlockEnum } from '../types'
|
import { BlockEnum } from '../types'
|
||||||
|
import useCurrentVars from '../hooks/use-current-vars'
|
||||||
import Empty from './empty'
|
import Empty from './empty'
|
||||||
import ActionButton from '@/app/components/base/action-button'
|
import ActionButton from '@/app/components/base/action-button'
|
||||||
import Badge from '@/app/components/base/badge'
|
import Badge from '@/app/components/base/badge'
|
||||||
import CopyFeedback from '@/app/components/base/copy-feedback'
|
import CopyFeedback from '@/app/components/base/copy-feedback'
|
||||||
import Tooltip from '@/app/components/base/tooltip'
|
import Tooltip from '@/app/components/base/tooltip'
|
||||||
import BlockIcon from '@/app/components/workflow/block-icon'
|
import BlockIcon from '@/app/components/workflow/block-icon'
|
||||||
|
import { BubbleX, Env } from '@/app/components/base/icons/src/vender/line/others'
|
||||||
import cn from '@/utils/classnames'
|
import cn from '@/utils/classnames'
|
||||||
|
|
||||||
|
export const currentVar = {
|
||||||
|
id: 'var-jfkldjjfkldaf-dfhekdfj',
|
||||||
|
type: 'node',
|
||||||
|
// type: 'conversation',
|
||||||
|
// type: 'environment',
|
||||||
|
name: 'out_put',
|
||||||
|
var_type: 'string',
|
||||||
|
// var_type: 'number',
|
||||||
|
// var_type: 'object',
|
||||||
|
// var_type: 'array[string]',
|
||||||
|
// var_type: 'array[number]',
|
||||||
|
// var_type: 'array[object]',
|
||||||
|
// var_type: 'file',
|
||||||
|
// var_type: 'array[file]',
|
||||||
|
value: 'tuituitui',
|
||||||
|
}
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
handleOpenMenu: () => void
|
handleOpenMenu: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const Right = ({ handleOpenMenu }: Props) => {
|
const Right = ({ handleOpenMenu }: Props) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
const bottomPanelWidth = useStore(s => s.bottomPanelWidth)
|
const bottomPanelWidth = useStore(s => s.bottomPanelWidth)
|
||||||
const setShowVariableInspectPanel = useStore(s => s.setShowVariableInspectPanel)
|
const setShowVariableInspectPanel = useStore(s => s.setShowVariableInspectPanel)
|
||||||
|
|
||||||
|
const current = currentVar
|
||||||
|
|
||||||
|
const {
|
||||||
|
resetToLastRunVar,
|
||||||
|
} = useCurrentVars()
|
||||||
|
|
||||||
|
const resetValue = () => {
|
||||||
|
resetToLastRunVar('node_id', current.name)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn('flex h-full flex-col')}>
|
<div className={cn('flex h-full flex-col')}>
|
||||||
{/* header */}
|
{/* header */}
|
||||||
@ -32,6 +63,16 @@ const Right = ({ handleOpenMenu }: Props) => {
|
|||||||
</ActionButton>
|
</ActionButton>
|
||||||
)}
|
)}
|
||||||
<div className='flex w-0 grow items-center gap-1'>
|
<div className='flex w-0 grow items-center gap-1'>
|
||||||
|
{current && (
|
||||||
|
<>
|
||||||
|
{current.type === 'environment' && (
|
||||||
|
<Env className='h-4 w-4 shrink-0 text-util-colors-violet-violet-600' />
|
||||||
|
)}
|
||||||
|
{current.type === 'conversation' && (
|
||||||
|
<BubbleX className='h-4 w-4 shrink-0 text-util-colors-teal-teal-700' />
|
||||||
|
)}
|
||||||
|
{current.type === 'node' && (
|
||||||
|
<>
|
||||||
<BlockIcon
|
<BlockIcon
|
||||||
className='shrink-0'
|
className='shrink-0'
|
||||||
type={BlockEnum.LLM}
|
type={BlockEnum.LLM}
|
||||||
@ -39,20 +80,30 @@ const Right = ({ handleOpenMenu }: Props) => {
|
|||||||
/>
|
/>
|
||||||
<div className='system-sm-regular shrink-0 text-text-secondary'>LLM</div>
|
<div className='system-sm-regular shrink-0 text-text-secondary'>LLM</div>
|
||||||
<div className='system-sm-regular shrink-0 text-text-quaternary'>/</div>
|
<div className='system-sm-regular shrink-0 text-text-quaternary'>/</div>
|
||||||
<div title='out_put' className='system-sm-semibold truncate text-text-secondary'>out_put</div>
|
</>
|
||||||
<div className='system-xs-medium ml-1 shrink-0 text-text-tertiary'>String</div>
|
)}
|
||||||
|
<div title={current.name} className='system-sm-semibold truncate text-text-secondary'>{current.name}</div>
|
||||||
|
<div className='system-xs-medium ml-1 shrink-0 text-text-tertiary'>{current.var_type}</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className='flex shrink-0 items-center gap-1'>
|
<div className='flex shrink-0 items-center gap-1'>
|
||||||
|
{current && (
|
||||||
|
<>
|
||||||
<Badge>
|
<Badge>
|
||||||
<span className='ml-[2.5px] mr-[4.5px] h-[3px] w-[3px] rounded bg-text-accent-secondary'></span>
|
<span className='ml-[2.5px] mr-[4.5px] h-[3px] w-[3px] rounded bg-text-accent-secondary'></span>
|
||||||
<span className='system-2xs-semibold-uupercase'>Edited</span>
|
<span className='system-2xs-semibold-uupercase'>{t('workflow.debug.variableInspect.edited')}</span>
|
||||||
</Badge>
|
</Badge>
|
||||||
<Tooltip popupContent={'Reset to last run value'}>
|
<Tooltip popupContent={t('workflow.debug.variableInspect.reset')}>
|
||||||
<ActionButton onClick={() => setShowVariableInspectPanel(false)}>
|
<ActionButton onClick={resetValue}>
|
||||||
<RiArrowGoBackLine className='h-4 w-4' />
|
<RiArrowGoBackLine className='h-4 w-4' />
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<CopyFeedback content='' />
|
{(current.type !== 'environment' || current.var_type !== 'secret') && (
|
||||||
|
<CopyFeedback content={current.value ? JSON.stringify(current.value) : ''} />
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<ActionButton onClick={() => setShowVariableInspectPanel(false)}>
|
<ActionButton onClick={() => setShowVariableInspectPanel(false)}>
|
||||||
<RiCloseLine className='h-4 w-4' />
|
<RiCloseLine className='h-4 w-4' />
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
@ -60,7 +111,7 @@ const Right = ({ handleOpenMenu }: Props) => {
|
|||||||
</div>
|
</div>
|
||||||
{/* content */}
|
{/* content */}
|
||||||
<div className='grow p-2'>
|
<div className='grow p-2'>
|
||||||
<Empty />
|
{!current && <Empty />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user