From b27f98995a3cc2478d6dd1f7657a33bed5c9db04 Mon Sep 17 00:00:00 2001 From: jZonG Date: Wed, 23 Apr 2025 15:07:00 +0800 Subject: [PATCH] right header --- .../workflow/variable-inspect/right.tsx | 91 +++++++++++++++---- 1 file changed, 71 insertions(+), 20 deletions(-) diff --git a/web/app/components/workflow/variable-inspect/right.tsx b/web/app/components/workflow/variable-inspect/right.tsx index 2ed3dd88a7..bf8b86bcc7 100644 --- a/web/app/components/workflow/variable-inspect/right.tsx +++ b/web/app/components/workflow/variable-inspect/right.tsx @@ -1,4 +1,5 @@ // import { useState } from 'react' +import { useTranslation } from 'react-i18next' import { RiArrowGoBackLine, RiCloseLine, @@ -6,22 +7,52 @@ import { } from '@remixicon/react' import { useStore } from '../store' import { BlockEnum } from '../types' +import useCurrentVars from '../hooks/use-current-vars' import Empty from './empty' import ActionButton from '@/app/components/base/action-button' import Badge from '@/app/components/base/badge' import CopyFeedback from '@/app/components/base/copy-feedback' import Tooltip from '@/app/components/base/tooltip' 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' +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 = { handleOpenMenu: () => void } const Right = ({ handleOpenMenu }: Props) => { + const { t } = useTranslation() const bottomPanelWidth = useStore(s => s.bottomPanelWidth) const setShowVariableInspectPanel = useStore(s => s.setShowVariableInspectPanel) + const current = currentVar + + const { + resetToLastRunVar, + } = useCurrentVars() + + const resetValue = () => { + resetToLastRunVar('node_id', current.name) + } + return (
{/* header */} @@ -32,27 +63,47 @@ const Right = ({ handleOpenMenu }: Props) => { )}
- -
LLM
-
/
-
out_put
-
String
+ {current && ( + <> + {current.type === 'environment' && ( + + )} + {current.type === 'conversation' && ( + + )} + {current.type === 'node' && ( + <> + +
LLM
+
/
+ + )} +
{current.name}
+
{current.var_type}
+ + )}
- - - Edited - - - setShowVariableInspectPanel(false)}> - - - - + {current && ( + <> + + + {t('workflow.debug.variableInspect.edited')} + + + + + + + {(current.type !== 'environment' || current.var_type !== 'secret') && ( + + )} + + )} setShowVariableInspectPanel(false)}> @@ -60,7 +111,7 @@ const Right = ({ handleOpenMenu }: Props) => {
{/* content */}
- + {!current && }
)