chore(web): new lint setup (#30020)

Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
Stephen Zhou
2025-12-23 16:58:55 +08:00
committed by GitHub
parent 9701a2994b
commit f2842da397
3356 changed files with 85046 additions and 81278 deletions

View File

@ -1,25 +1,25 @@
import type { IChatItem } from '@/app/components/base/chat/chat/type'
import type { ChatItem, ChatItemInTree } from '@/app/components/base/chat/types'
import { RiCloseLine } from '@remixicon/react'
import {
memo,
useCallback,
useEffect,
useState,
} from 'react'
import { RiCloseLine } from '@remixicon/react'
import { useStore as useAppStore } from '@/app/components/app/store'
import Chat from '@/app/components/base/chat/chat'
import { buildChatItemTree, getThreadMessages } from '@/app/components/base/chat/utils'
import { getProcessedFilesFromResponse } from '@/app/components/base/file-uploader/utils'
import Loading from '@/app/components/base/loading'
import { fetchConversationMessages } from '@/service/debug'
import { useWorkflowRun } from '../../hooks'
import {
useStore,
useWorkflowStore,
} from '../../store'
import { useWorkflowRun } from '../../hooks'
import { formatWorkflowRunIdentifier } from '../../utils'
import UserInput from './user-input'
import Chat from '@/app/components/base/chat/chat'
import type { ChatItem, ChatItemInTree } from '@/app/components/base/chat/types'
import { fetchConversationMessages } from '@/service/debug'
import { useStore as useAppStore } from '@/app/components/app/store'
import Loading from '@/app/components/base/loading'
import { getProcessedFilesFromResponse } from '@/app/components/base/file-uploader/utils'
import type { IChatItem } from '@/app/components/base/chat/chat/type'
import { buildChatItemTree, getThreadMessages } from '@/app/components/base/chat/utils'
function getFormattedChatList(messages: any[]) {
const res: ChatItem[] = []
@ -87,48 +87,48 @@ const ChatRecord = () => {
return (
<div
className='flex h-full w-[420px] flex-col rounded-l-2xl border border-components-panel-border bg-chatbot-bg shadow-xl'
className="flex h-full w-[420px] flex-col rounded-l-2xl border border-components-panel-border bg-chatbot-bg shadow-xl"
// style={{
// background: 'linear-gradient(156deg, rgba(242, 244, 247, 0.80) 0%, rgba(242, 244, 247, 0.00) 99.43%), var(--white, #FFF)',
// }}
>
{!fetched && (
<div className='flex h-full items-center justify-center'>
<div className="flex h-full items-center justify-center">
<Loading />
</div>
)}
{fetched && (
<>
<div className='flex shrink-0 items-center justify-between p-4 pb-1 text-base font-semibold text-text-primary'>
<div className="flex shrink-0 items-center justify-between p-4 pb-1 text-base font-semibold text-text-primary">
{`TEST CHAT${formatWorkflowRunIdentifier(historyWorkflowData?.finished_at)}`}
<div
className='flex h-6 w-6 cursor-pointer items-center justify-center'
className="flex h-6 w-6 cursor-pointer items-center justify-center"
onClick={() => {
handleLoadBackupDraft()
workflowStore.setState({ historyWorkflowData: undefined })
}}
>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
<RiCloseLine className="h-4 w-4 text-text-tertiary" />
</div>
</div>
<div className='h-0 grow'>
<div className="h-0 grow">
<Chat
config={{
supportCitationHitInfo: true,
questionEditEnable: false,
} as any}
chatList={threadChatItems}
chatContainerClassName='px-3'
chatContainerInnerClassName='pt-6 w-full max-w-full mx-auto'
chatFooterClassName='px-4 rounded-b-2xl'
chatFooterInnerClassName='pb-4 w-full max-w-full mx-auto'
chatContainerClassName="px-3"
chatContainerInnerClassName="pt-6 w-full max-w-full mx-auto"
chatFooterClassName="px-4 rounded-b-2xl"
chatFooterInnerClassName="pb-4 w-full max-w-full mx-auto"
chatNode={<UserInput />}
noChatInput
allToolIcons={{}}
showPromptLog
switchSibling={switchSibling}
noSpacing
chatAnswerContainerInner='!pr-2'
chatAnswerContainerInner="!pr-2"
/>
</div>
</>

View File

@ -1,9 +1,9 @@
import { RiArrowDownSLine } from '@remixicon/react'
import {
memo,
useState,
} from 'react'
import { useTranslation } from 'react-i18next'
import { RiArrowDownSLine } from '@remixicon/react'
const UserInput = () => {
const { t } = useTranslation()
@ -32,15 +32,15 @@ const UserInput = () => {
/>
{t('workflow.panel.userInputField').toLocaleUpperCase()}
</div>
<div className='px-2 pb-3 pt-1'>
<div className="px-2 pb-3 pt-1">
{
expanded && (
<div className='py-2 text-[13px] text-text-primary'>
<div className="py-2 text-[13px] text-text-primary">
{
variables.map((variable: any) => (
<div
key={variable.variable}
className='mb-2 last-of-type:mb-0'
className="mb-2 last-of-type:mb-0"
>
</div>
))

View File

@ -1,13 +1,13 @@
'use client'
import type { FC } from 'react'
import React, { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { RiAddLine } from '@remixicon/react'
import { produce } from 'immer'
import RemoveButton from '@/app/components/workflow/nodes/_base/components/remove-button'
import React, { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import Button from '@/app/components/base/button'
import BoolValue from './bool-value'
import RemoveButton from '@/app/components/workflow/nodes/_base/components/remove-button'
import { cn } from '@/utils/classnames'
import BoolValue from './bool-value'
type Props = {
className?: string
@ -50,20 +50,20 @@ const ArrayValueList: FC<Props> = ({
return (
<div className={cn('w-full space-y-2', className)}>
{list.map((item, index) => (
<div className='flex items-center space-x-1' key={index}>
<div className="flex items-center space-x-1" key={index}>
<BoolValue
value={item}
onChange={handleChange(index)}
/>
<RemoveButton
className='!bg-gray-100 !p-2 hover:!bg-gray-200'
className="!bg-gray-100 !p-2 hover:!bg-gray-200"
onClick={handleItemRemove(index)}
/>
</div>
))}
<Button variant='tertiary' className='w-full' onClick={handleItemAdd}>
<RiAddLine className='mr-1 h-4 w-4' />
<Button variant="tertiary" className="w-full" onClick={handleItemAdd}>
<RiAddLine className="mr-1 h-4 w-4" />
<span>{t('workflow.chatVariable.modal.addArrayValue')}</span>
</Button>
</div>

View File

@ -1,12 +1,12 @@
'use client'
import type { FC } from 'react'
import React, { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { RiAddLine } from '@remixicon/react'
import { produce } from 'immer'
import RemoveButton from '@/app/components/workflow/nodes/_base/components/remove-button'
import React, { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import Button from '@/app/components/base/button'
import Input from '@/app/components/base/input'
import RemoveButton from '@/app/components/workflow/nodes/_base/components/remove-button'
type Props = {
isString: boolean
@ -47,9 +47,9 @@ const ArrayValueList: FC<Props> = ({
}, [list, onChange])
return (
<div className='w-full space-y-2'>
<div className="w-full space-y-2">
{list.map((item, index) => (
<div className='flex items-center space-x-1' key={index}>
<div className="flex items-center space-x-1" key={index}>
<Input
placeholder={t('workflow.chatVariable.modal.arrayValue') || ''}
value={list[index]}
@ -57,13 +57,13 @@ const ArrayValueList: FC<Props> = ({
type={isString ? 'text' : 'number'}
/>
<RemoveButton
className='!bg-gray-100 !p-2 hover:!bg-gray-200'
className="!bg-gray-100 !p-2 hover:!bg-gray-200"
onClick={handleItemRemove(index)}
/>
</div>
))}
<Button variant='tertiary' className='w-full' onClick={handleItemAdd}>
<RiAddLine className='mr-1 h-4 w-4' />
<Button variant="tertiary" className="w-full" onClick={handleItemAdd}>
<RiAddLine className="mr-1 h-4 w-4" />
<span>{t('workflow.chatVariable.modal.addArrayValue')}</span>
</Button>
</div>

View File

@ -20,15 +20,17 @@ const BoolValue: FC<Props> = ({
}, [onChange])
return (
<div className='flex w-full space-x-1'>
<OptionCard className='grow'
<div className="flex w-full space-x-1">
<OptionCard
className="grow"
selected={booleanValue}
title='True'
title="True"
onSelect={handleChange(true)}
/>
<OptionCard className='grow'
<OptionCard
className="grow"
selected={!booleanValue}
title='False'
title="False"
onSelect={handleChange(false)}
/>
</div>

View File

@ -1,12 +1,12 @@
'use client'
import type { FC } from 'react'
import { produce } from 'immer'
import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { produce } from 'immer'
import { useContext } from 'use-context-selector'
import { ToastContext } from '@/app/components/base/toast'
import VariableTypeSelector from '@/app/components/workflow/panel/chat-variable-panel/components/variable-type-select'
import RemoveButton from '@/app/components/workflow/nodes/_base/components/remove-button'
import VariableTypeSelector from '@/app/components/workflow/panel/chat-variable-panel/components/variable-type-select'
import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type'
type Props = {
@ -91,30 +91,30 @@ const ObjectValueItem: FC<Props> = ({
}, [handleItemAdd, index, list.length])
return (
<div className='group flex border-t border-gray-200'>
<div className="group flex border-t border-gray-200">
{/* Key */}
<div className='w-[120px] border-r border-gray-200'>
<div className="w-[120px] border-r border-gray-200">
<input
className='system-xs-regular placeholder:system-xs-regular block h-7 w-full appearance-none px-2 text-text-secondary caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:bg-state-base-hover focus:bg-components-input-bg-active'
className="system-xs-regular placeholder:system-xs-regular block h-7 w-full appearance-none px-2 text-text-secondary caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:bg-state-base-hover focus:bg-components-input-bg-active"
placeholder={t('workflow.chatVariable.modal.objectKey') || ''}
value={list[index].key}
onChange={handleKeyChange(index)}
/>
</div>
{/* Type */}
<div className='w-[96px] border-r border-gray-200'>
<div className="w-[96px] border-r border-gray-200">
<VariableTypeSelector
inCell
value={list[index].type}
list={typeList}
onSelect={handleTypeChange(index)}
popupClassName='w-[120px]'
popupClassName="w-[120px]"
/>
</div>
{/* Value */}
<div className='relative w-[230px]'>
<div className="relative w-[230px]">
<input
className='system-xs-regular placeholder:system-xs-regular block h-7 w-full appearance-none px-2 text-text-secondary caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:bg-state-base-hover focus:bg-components-input-bg-active'
className="system-xs-regular placeholder:system-xs-regular block h-7 w-full appearance-none px-2 text-text-secondary caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:bg-state-base-hover focus:bg-components-input-bg-active"
placeholder={t('workflow.chatVariable.modal.objectValue') || ''}
value={list[index].value}
onChange={handleValueChange(index)}
@ -124,7 +124,7 @@ const ObjectValueItem: FC<Props> = ({
/>
{list.length > 1 && !isFocus && (
<RemoveButton
className='absolute right-1 top-0.5 z-10 hidden group-hover:block'
className="absolute right-1 top-0.5 z-10 hidden group-hover:block"
onClick={handleItemRemove(index)}
/>
)}

View File

@ -16,11 +16,11 @@ const ObjectValueList: FC<Props> = ({
const { t } = useTranslation()
return (
<div className='w-full overflow-hidden rounded-lg border border-gray-200'>
<div className='system-xs-medium flex h-7 items-center uppercase text-text-tertiary'>
<div className='flex h-full w-[120px] items-center border-r border-gray-200 pl-2'>{t('workflow.chatVariable.modal.objectKey')}</div>
<div className='flex h-full w-[96px] items-center border-r border-gray-200 pl-2'>{t('workflow.chatVariable.modal.objectType')}</div>
<div className='flex h-full w-[230px] items-center pl-2 pr-1'>{t('workflow.chatVariable.modal.objectValue')}</div>
<div className="w-full overflow-hidden rounded-lg border border-gray-200">
<div className="system-xs-medium flex h-7 items-center uppercase text-text-tertiary">
<div className="flex h-full w-[120px] items-center border-r border-gray-200 pl-2">{t('workflow.chatVariable.modal.objectKey')}</div>
<div className="flex h-full w-[96px] items-center border-r border-gray-200 pl-2">{t('workflow.chatVariable.modal.objectType')}</div>
<div className="flex h-full w-[230px] items-center pl-2 pr-1">{t('workflow.chatVariable.modal.objectValue')}</div>
</div>
{list.map((item, index) => (
<ObjectValueItem

View File

@ -1,8 +1,8 @@
import { memo, useState } from 'react'
import { capitalize } from 'lodash-es'
import { RiDeleteBinLine, RiEditLine } from '@remixicon/react'
import { BubbleX } from '@/app/components/base/icons/src/vender/line/others'
import type { ConversationVariable } from '@/app/components/workflow/types'
import { RiDeleteBinLine, RiEditLine } from '@remixicon/react'
import { capitalize } from 'lodash-es'
import { memo, useState } from 'react'
import { BubbleX } from '@/app/components/base/icons/src/vender/line/others'
import { cn } from '@/utils/classnames'
type VariableItemProps = {
@ -21,27 +21,28 @@ const VariableItem = ({
<div className={cn(
'radius-md mb-1 border border-components-panel-border-subtle bg-components-panel-on-panel-item-bg px-2.5 py-2 shadow-xs hover:bg-components-panel-on-panel-item-bg-hover',
destructive && 'border-state-destructive-border hover:bg-state-destructive-hover',
)}>
<div className='flex items-center justify-between'>
<div className='flex grow items-center gap-1'>
<BubbleX className='h-4 w-4 text-util-colors-teal-teal-700' />
<div className='system-sm-medium text-text-primary'>{item.name}</div>
<div className='system-xs-medium text-text-tertiary'>{capitalize(item.value_type)}</div>
)}
>
<div className="flex items-center justify-between">
<div className="flex grow items-center gap-1">
<BubbleX className="h-4 w-4 text-util-colors-teal-teal-700" />
<div className="system-sm-medium text-text-primary">{item.name}</div>
<div className="system-xs-medium text-text-tertiary">{capitalize(item.value_type)}</div>
</div>
<div className='flex shrink-0 items-center gap-1 text-text-tertiary'>
<div className='radius-md cursor-pointer p-1 hover:bg-state-base-hover hover:text-text-secondary'>
<RiEditLine className='h-4 w-4' onClick={() => onEdit(item)}/>
<div className="flex shrink-0 items-center gap-1 text-text-tertiary">
<div className="radius-md cursor-pointer p-1 hover:bg-state-base-hover hover:text-text-secondary">
<RiEditLine className="h-4 w-4" onClick={() => onEdit(item)} />
</div>
<div
className='radius-md cursor-pointer p-1 hover:bg-state-destructive-hover hover:text-text-destructive'
className="radius-md cursor-pointer p-1 hover:bg-state-destructive-hover hover:text-text-destructive"
onMouseOver={() => setDestructive(true)}
onMouseOut={() => setDestructive(false)}
>
<RiDeleteBinLine className='h-4 w-4' onClick={() => onDelete(item)}/>
<RiDeleteBinLine className="h-4 w-4" onClick={() => onDelete(item)} />
</div>
</div>
</div>
<div className='system-xs-regular truncate text-text-tertiary'>{item.description}</div>
<div className="system-xs-regular truncate text-text-tertiary">{item.description}</div>
</div>
)
}

View File

@ -1,15 +1,15 @@
'use client'
import type { ConversationVariable } from '@/app/components/workflow/types'
import { RiAddLine } from '@remixicon/react'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { RiAddLine } from '@remixicon/react'
import Button from '@/app/components/base/button'
import VariableModal from '@/app/components/workflow/panel/chat-variable-panel/components/variable-modal'
import {
PortalToFollowElem,
PortalToFollowElemContent,
PortalToFollowElemTrigger,
} from '@/app/components/base/portal-to-follow-elem'
import type { ConversationVariable } from '@/app/components/workflow/types'
import VariableModal from '@/app/components/workflow/panel/chat-variable-panel/components/variable-modal'
type Props = {
open: boolean
@ -38,7 +38,7 @@ const VariableModalTrigger = ({
if (open)
onClose()
}}
placement='left-start'
placement="left-start"
offset={{
mainAxis: 8,
alignmentAxis: showTip ? -278 : -48,
@ -48,13 +48,14 @@ const VariableModalTrigger = ({
setOpen(v => !v)
if (open)
onClose()
}}>
<Button variant='primary'>
<RiAddLine className='mr-1 h-4 w-4' />
<span className='system-sm-medium'>{t('workflow.chatVariable.button')}</span>
}}
>
<Button variant="primary">
<RiAddLine className="mr-1 h-4 w-4" />
<span className="system-sm-medium">{t('workflow.chatVariable.button')}</span>
</Button>
</PortalToFollowElemTrigger>
<PortalToFollowElemContent className='z-[11]'>
<PortalToFollowElemContent className="z-[11]">
<VariableModal
chatVar={chatVar}
onSave={onSave}

View File

@ -1,23 +1,19 @@
import type { ConversationVariable } from '@/app/components/workflow/types'
import { RiCloseLine, RiDraftLine, RiInputField } from '@remixicon/react'
import React, { useCallback, useEffect, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { useContext } from 'use-context-selector'
import { v4 as uuid4 } from 'uuid'
import { RiCloseLine, RiDraftLine, RiInputField } from '@remixicon/react'
import VariableTypeSelector from '@/app/components/workflow/panel/chat-variable-panel/components/variable-type-select'
import ObjectValueList from '@/app/components/workflow/panel/chat-variable-panel/components/object-value-list'
import { DEFAULT_OBJECT_VALUE } from '@/app/components/workflow/panel/chat-variable-panel/components/object-value-item'
import ArrayValueList from '@/app/components/workflow/panel/chat-variable-panel/components/array-value-list'
import Button from '@/app/components/base/button'
import Input from '@/app/components/base/input'
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
import { ToastContext } from '@/app/components/base/toast'
import { useStore } from '@/app/components/workflow/store'
import type { ConversationVariable } from '@/app/components/workflow/types'
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
import ArrayValueList from '@/app/components/workflow/panel/chat-variable-panel/components/array-value-list'
import { DEFAULT_OBJECT_VALUE } from '@/app/components/workflow/panel/chat-variable-panel/components/object-value-item'
import ObjectValueList from '@/app/components/workflow/panel/chat-variable-panel/components/object-value-list'
import VariableTypeSelector from '@/app/components/workflow/panel/chat-variable-panel/components/variable-type-select'
import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type'
import { cn } from '@/utils/classnames'
import BoolValue from './bool-value'
import ArrayBoolList from './array-bool-list'
import {
arrayBoolPlaceholder,
arrayNumberPlaceholder,
@ -25,7 +21,11 @@ import {
arrayStringPlaceholder,
objectPlaceholder,
} from '@/app/components/workflow/panel/chat-variable-panel/utils'
import { useStore } from '@/app/components/workflow/store'
import { cn } from '@/utils/classnames'
import { checkKeys, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var'
import ArrayBoolList from './array-bool-list'
import BoolValue from './bool-value'
export type ModalPropsType = {
chatVar?: ConversationVariable
@ -147,7 +147,7 @@ const ChatVariableModal = ({
setEditInJSON(true)
if (v === ChatVarType.String || v === ChatVarType.Number || v === ChatVarType.Object)
setEditInJSON(false)
if(v === ChatVarType.Boolean)
if (v === ChatVarType.Boolean)
setValue(false)
if (v === ChatVarType.ArrayBoolean)
setValue([false])
@ -197,8 +197,8 @@ const ChatVariableModal = ({
}
}
if(type === ChatVarType.ArrayBoolean) {
if(editInJSON)
if (type === ChatVarType.ArrayBoolean) {
if (editInJSON)
setEditorContent(JSON.stringify(value.map((item: boolean) => item ? 'True' : 'False')))
}
setEditInJSON(editInJSON)
@ -213,7 +213,7 @@ const ChatVariableModal = ({
setEditorContent(content)
try {
let newValue = JSON.parse(content)
if(type === ChatVarType.ArrayBoolean) {
if (type === ChatVarType.ArrayBoolean) {
newValue = newValue.map((item: string | boolean) => {
if (item === 'True' || item === 'true' || item === true)
return true
@ -271,75 +271,75 @@ const ChatVariableModal = ({
<div
className={cn('flex h-full w-[360px] flex-col rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-2xl', type === ChatVarType.Object && 'w-[480px]')}
>
<div className='system-xl-semibold mb-3 flex shrink-0 items-center justify-between p-4 pb-0 text-text-primary'>
<div className="system-xl-semibold mb-3 flex shrink-0 items-center justify-between p-4 pb-0 text-text-primary">
{!chatVar ? t('workflow.chatVariable.modal.title') : t('workflow.chatVariable.modal.editTitle')}
<div className='flex items-center'>
<div className="flex items-center">
<div
className='flex h-6 w-6 cursor-pointer items-center justify-center'
className="flex h-6 w-6 cursor-pointer items-center justify-center"
onClick={onClose}
>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
<RiCloseLine className="h-4 w-4 text-text-tertiary" />
</div>
</div>
</div>
<div className='max-h-[480px] overflow-y-auto px-4 py-2'>
<div className="max-h-[480px] overflow-y-auto px-4 py-2">
{/* name */}
<div className='mb-4'>
<div className='system-sm-semibold mb-1 flex h-6 items-center text-text-secondary'>{t('workflow.chatVariable.modal.name')}</div>
<div className='flex'>
<div className="mb-4">
<div className="system-sm-semibold mb-1 flex h-6 items-center text-text-secondary">{t('workflow.chatVariable.modal.name')}</div>
<div className="flex">
<Input
placeholder={t('workflow.chatVariable.modal.namePlaceholder') || ''}
value={name}
onChange={handleVarNameChange}
onBlur={e => checkVariableName(e.target.value)}
type='text'
type="text"
/>
</div>
</div>
{/* type */}
<div className='mb-4'>
<div className='system-sm-semibold mb-1 flex h-6 items-center text-text-secondary'>{t('workflow.chatVariable.modal.type')}</div>
<div className='flex'>
<div className="mb-4">
<div className="system-sm-semibold mb-1 flex h-6 items-center text-text-secondary">{t('workflow.chatVariable.modal.type')}</div>
<div className="flex">
<VariableTypeSelector
value={type}
list={typeList}
onSelect={handleTypeChange}
popupClassName='w-[327px]'
popupClassName="w-[327px]"
/>
</div>
</div>
{/* default value */}
<div className='mb-4'>
<div className='system-sm-semibold mb-1 flex h-6 items-center justify-between text-text-secondary'>
<div className="mb-4">
<div className="system-sm-semibold mb-1 flex h-6 items-center justify-between text-text-secondary">
<div>{t('workflow.chatVariable.modal.value')}</div>
{(type === ChatVarType.ArrayString || type === ChatVarType.ArrayNumber || type === ChatVarType.ArrayBoolean) && (
<Button
variant='ghost'
size='small'
className='text-text-tertiary'
variant="ghost"
size="small"
className="text-text-tertiary"
onClick={() => handleEditorChange(!editInJSON)}
>
{editInJSON ? <RiInputField className='mr-1 h-3.5 w-3.5' /> : <RiDraftLine className='mr-1 h-3.5 w-3.5' />}
{editInJSON ? <RiInputField className="mr-1 h-3.5 w-3.5" /> : <RiDraftLine className="mr-1 h-3.5 w-3.5" />}
{editInJSON ? t('workflow.chatVariable.modal.oneByOne') : t('workflow.chatVariable.modal.editInJSON')}
</Button>
)}
{type === ChatVarType.Object && (
<Button
variant='ghost'
size='small'
className='text-text-tertiary'
variant="ghost"
size="small"
className="text-text-tertiary"
onClick={() => handleEditorChange(!editInJSON)}
>
{editInJSON ? <RiInputField className='mr-1 h-3.5 w-3.5' /> : <RiDraftLine className='mr-1 h-3.5 w-3.5' />}
{editInJSON ? <RiInputField className="mr-1 h-3.5 w-3.5" /> : <RiDraftLine className="mr-1 h-3.5 w-3.5" />}
{editInJSON ? t('workflow.chatVariable.modal.editInForm') : t('workflow.chatVariable.modal.editInJSON')}
</Button>
)}
</div>
<div className='flex'>
<div className="flex">
{type === ChatVarType.String && (
// Input will remove \n\r, so use Textarea just like description area
<textarea
className='system-sm-regular placeholder:system-sm-regular block h-20 w-full resize-none appearance-none rounded-lg border border-transparent bg-components-input-bg-normal p-2 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs'
className="system-sm-regular placeholder:system-sm-regular block h-20 w-full resize-none appearance-none rounded-lg border border-transparent bg-components-input-bg-normal p-2 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs"
value={value}
placeholder={t('workflow.chatVariable.modal.valuePlaceholder') || ''}
onChange={e => setValue(e.target.value)}
@ -350,7 +350,7 @@ const ChatVariableModal = ({
placeholder={t('workflow.chatVariable.modal.valuePlaceholder') || ''}
value={value}
onChange={e => setValue(Number(e.target.value))}
type='number'
type="number"
/>
)}
{type === ChatVarType.Boolean && (
@ -387,13 +387,13 @@ const ChatVariableModal = ({
)}
{editInJSON && (
<div className='w-full rounded-[10px] bg-components-input-bg-normal py-2 pl-3 pr-1' style={{ height: editorMinHeight }}>
<div className="w-full rounded-[10px] bg-components-input-bg-normal py-2 pl-3 pr-1" style={{ height: editorMinHeight }}>
<CodeEditor
isExpand
noWrapper
language={CodeLanguage.json}
value={editorContent}
placeholder={<div className='whitespace-pre'>{placeholder}</div>}
placeholder={<div className="whitespace-pre">{placeholder}</div>}
onChange={handleEditorValueChange}
/>
</div>
@ -401,11 +401,11 @@ const ChatVariableModal = ({
</div>
</div>
{/* description */}
<div className=''>
<div className='system-sm-semibold mb-1 flex h-6 items-center text-text-secondary'>{t('workflow.chatVariable.modal.description')}</div>
<div className='flex'>
<div className="">
<div className="system-sm-semibold mb-1 flex h-6 items-center text-text-secondary">{t('workflow.chatVariable.modal.description')}</div>
<div className="flex">
<textarea
className='system-sm-regular placeholder:system-sm-regular block h-20 w-full resize-none appearance-none rounded-lg border border-transparent bg-components-input-bg-normal p-2 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs'
className="system-sm-regular placeholder:system-sm-regular block h-20 w-full resize-none appearance-none rounded-lg border border-transparent bg-components-input-bg-normal p-2 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs"
value={description}
placeholder={t('workflow.chatVariable.modal.descriptionPlaceholder') || ''}
onChange={e => setDescription(e.target.value)}
@ -413,10 +413,10 @@ const ChatVariableModal = ({
</div>
</div>
</div>
<div className='flex flex-row-reverse rounded-b-2xl p-4 pt-2'>
<div className='flex gap-2'>
<div className="flex flex-row-reverse rounded-b-2xl p-4 pt-2">
<div className="flex gap-2">
<Button onClick={onClose}>{t('common.operation.cancel')}</Button>
<Button variant='primary' onClick={handleSave}>{t('common.operation.save')}</Button>
<Button variant="primary" onClick={handleSave}>{t('common.operation.save')}</Button>
</div>
</div>
</div>

View File

@ -1,6 +1,6 @@
'use client'
import React, { useState } from 'react'
import { RiArrowDownSLine, RiCheckLine } from '@remixicon/react'
import React, { useState } from 'react'
import {
PortalToFollowElem,
PortalToFollowElemContent,
@ -29,32 +29,40 @@ const VariableTypeSelector = ({
<PortalToFollowElem
open={open}
onOpenChange={() => setOpen(v => !v)}
placement='bottom'
placement="bottom"
>
<PortalToFollowElemTrigger className='w-full' onClick={() => setOpen(v => !v)}>
<PortalToFollowElemTrigger className="w-full" onClick={() => setOpen(v => !v)}>
<div className={cn(
'flex w-full cursor-pointer items-center px-2',
!inCell && 'radius-md bg-components-input-bg-normal py-1 hover:bg-state-base-hover-alt',
inCell && 'py-0.5 hover:bg-state-base-hover',
open && !inCell && 'bg-state-base-hover-alt hover:bg-state-base-hover-alt',
open && inCell && 'bg-state-base-hover hover:bg-state-base-hover',
)}>
)}
>
<div className={cn(
'system-sm-regular grow truncate p-1 text-components-input-text-filled',
inCell && 'system-xs-regular text-text-secondary',
)}>{value}</div>
<RiArrowDownSLine className='ml-0.5 h-4 w-4 text-text-quaternary' />
)}
>
{value}
</div>
<RiArrowDownSLine className="ml-0.5 h-4 w-4 text-text-quaternary" />
</div>
</PortalToFollowElemTrigger>
<PortalToFollowElemContent className={cn('z-[11] w-full', popupClassName)}>
<div className='radius-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-1 shadow-lg'>
<div className="radius-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-1 shadow-lg">
{list.map((item: any) => (
<div key={item} className='radius-md flex cursor-pointer items-center gap-2 py-[6px] pl-3 pr-2 hover:bg-state-base-hover' onClick={() => {
onSelect(item)
setOpen(false)
}}>
<div className='system-md-regular grow truncate text-text-secondary'>{item}</div>
{value === item && <RiCheckLine className='h-4 w-4 text-text-accent' />}
<div
key={item}
className="radius-md flex cursor-pointer items-center gap-2 py-[6px] pl-3 pr-2 hover:bg-state-base-hover"
onClick={() => {
onSelect(item)
setOpen(false)
}}
>
<div className="system-md-regular grow truncate text-text-secondary">{item}</div>
{value === item && <RiCheckLine className="h-4 w-4 text-text-accent" />}
</div>
))}
</div>

View File

@ -1,25 +1,25 @@
import type {
ConversationVariable,
} from '@/app/components/workflow/types'
import { RiBookOpenLine, RiCloseLine } from '@remixicon/react'
import {
memo,
useCallback,
useState,
} from 'react'
import { useTranslation } from 'react-i18next'
import {
useStoreApi,
} from 'reactflow'
import { RiBookOpenLine, RiCloseLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import { useStore } from '@/app/components/workflow/store'
import ActionButton, { ActionButtonState } from '@/app/components/base/action-button'
import { BubbleX, LongArrowLeft, LongArrowRight } from '@/app/components/base/icons/src/vender/line/others'
import BlockIcon from '@/app/components/workflow/block-icon'
import VariableModalTrigger from '@/app/components/workflow/panel/chat-variable-panel/components/variable-modal-trigger'
import VariableItem from '@/app/components/workflow/panel/chat-variable-panel/components/variable-item'
import RemoveEffectVarConfirm from '@/app/components/workflow/nodes/_base/components/remove-effect-var-confirm'
import type {
ConversationVariable,
} from '@/app/components/workflow/types'
import { findUsedVarNodes, updateNodeVars } from '@/app/components/workflow/nodes/_base/components/variable/utils'
import { useNodesSyncDraft } from '@/app/components/workflow/hooks/use-nodes-sync-draft'
import RemoveEffectVarConfirm from '@/app/components/workflow/nodes/_base/components/remove-effect-var-confirm'
import { findUsedVarNodes, updateNodeVars } from '@/app/components/workflow/nodes/_base/components/variable/utils'
import VariableItem from '@/app/components/workflow/panel/chat-variable-panel/components/variable-item'
import VariableModalTrigger from '@/app/components/workflow/panel/chat-variable-panel/components/variable-modal-trigger'
import { useStore } from '@/app/components/workflow/store'
import { BlockEnum } from '@/app/components/workflow/types'
import { useDocLink } from '@/context/i18n'
import { cn } from '@/utils/classnames'
@ -128,64 +128,68 @@ const ChatVariablePanel = () => {
'relative flex h-full w-[420px] flex-col rounded-l-2xl border border-components-panel-border bg-components-panel-bg-alt',
)}
>
<div className='system-xl-semibold flex shrink-0 items-center justify-between p-4 pb-0 text-text-primary'>
<div className="system-xl-semibold flex shrink-0 items-center justify-between p-4 pb-0 text-text-primary">
{t('workflow.chatVariable.panelTitle')}
<div className='flex items-center gap-1'>
<div className="flex items-center gap-1">
<ActionButton state={showTip ? ActionButtonState.Active : undefined} onClick={() => setShowTip(!showTip)}>
<RiBookOpenLine className='h-4 w-4' />
<RiBookOpenLine className="h-4 w-4" />
</ActionButton>
<div
className='flex h-6 w-6 cursor-pointer items-center justify-center'
className="flex h-6 w-6 cursor-pointer items-center justify-center"
onClick={() => setShowChatVariablePanel(false)}
>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
<RiCloseLine className="h-4 w-4 text-text-tertiary" />
</div>
</div>
</div>
{showTip && (
<div className='shrink-0 px-3 pb-2 pt-2.5'>
<div className='radius-2xl relative bg-background-section-burn p-3'>
<div className='system-2xs-medium-uppercase inline-block rounded-[5px] border border-divider-deep px-[5px] py-[3px] text-text-tertiary'>TIPS</div>
<div className='system-sm-regular mb-4 mt-1 text-text-secondary'>
<div className="shrink-0 px-3 pb-2 pt-2.5">
<div className="radius-2xl relative bg-background-section-burn p-3">
<div className="system-2xs-medium-uppercase inline-block rounded-[5px] border border-divider-deep px-[5px] py-[3px] text-text-tertiary">TIPS</div>
<div className="system-sm-regular mb-4 mt-1 text-text-secondary">
{t('workflow.chatVariable.panelDescription')}
<a target='_blank' rel='noopener noreferrer' className='text-text-accent'
<a
target="_blank"
rel="noopener noreferrer"
className="text-text-accent"
href={docLink('/guides/workflow/variables#conversation-variables', {
'zh-Hans': '/guides/workflow/variables#会话变量',
'ja-JP': '/guides/workflow/variables#会話変数',
})}>
})}
>
{t('workflow.chatVariable.docLink')}
</a>
</div>
<div className='flex items-center gap-2'>
<div className='radius-lg flex flex-col border border-workflow-block-border bg-workflow-block-bg p-3 pb-4 shadow-md'>
<BubbleX className='mb-1 h-4 w-4 shrink-0 text-util-colors-teal-teal-700' />
<div className='system-xs-semibold text-text-secondary'>conversation_var</div>
<div className='system-2xs-regular text-text-tertiary'>String</div>
<div className="flex items-center gap-2">
<div className="radius-lg flex flex-col border border-workflow-block-border bg-workflow-block-bg p-3 pb-4 shadow-md">
<BubbleX className="mb-1 h-4 w-4 shrink-0 text-util-colors-teal-teal-700" />
<div className="system-xs-semibold text-text-secondary">conversation_var</div>
<div className="system-2xs-regular text-text-tertiary">String</div>
</div>
<div className='grow'>
<div className='mb-2 flex items-center gap-2 py-1'>
<div className='flex h-3 w-16 shrink-0 items-center gap-1 px-1'>
<LongArrowLeft className='h-2 grow text-text-quaternary' />
<div className='system-2xs-medium shrink-0 text-text-tertiary'>WRITE</div>
<div className="grow">
<div className="mb-2 flex items-center gap-2 py-1">
<div className="flex h-3 w-16 shrink-0 items-center gap-1 px-1">
<LongArrowLeft className="h-2 grow text-text-quaternary" />
<div className="system-2xs-medium shrink-0 text-text-tertiary">WRITE</div>
</div>
<BlockIcon className='shrink-0' type={BlockEnum.Assigner} />
<div className='system-xs-semibold grow truncate text-text-secondary'>{t('workflow.blocks.assigner')}</div>
<BlockIcon className="shrink-0" type={BlockEnum.Assigner} />
<div className="system-xs-semibold grow truncate text-text-secondary">{t('workflow.blocks.assigner')}</div>
</div>
<div className='flex items-center gap-2 py-1'>
<div className='flex h-3 w-16 shrink-0 items-center gap-1 px-1'>
<div className='system-2xs-medium shrink-0 text-text-tertiary'>READ</div>
<LongArrowRight className='h-2 grow text-text-quaternary' />
<div className="flex items-center gap-2 py-1">
<div className="flex h-3 w-16 shrink-0 items-center gap-1 px-1">
<div className="system-2xs-medium shrink-0 text-text-tertiary">READ</div>
<LongArrowRight className="h-2 grow text-text-quaternary" />
</div>
<BlockIcon className='shrink-0' type={BlockEnum.LLM} />
<div className='system-xs-semibold grow truncate text-text-secondary'>{t('workflow.blocks.llm')}</div>
<BlockIcon className="shrink-0" type={BlockEnum.LLM} />
<div className="system-xs-semibold grow truncate text-text-secondary">{t('workflow.blocks.llm')}</div>
</div>
</div>
</div>
<div className='absolute right-[38px] top-[-4px] z-10 h-3 w-3 rotate-45 bg-background-section-burn' />
<div className="absolute right-[38px] top-[-4px] z-10 h-3 w-3 rotate-45 bg-background-section-burn" />
</div>
</div>
)}
<div className='shrink-0 px-4 pb-3 pt-2'>
<div className="shrink-0 px-4 pb-3 pt-2">
<VariableModalTrigger
open={showVariableModal}
setOpen={setShowVariableModal}
@ -195,7 +199,7 @@ const ChatVariablePanel = () => {
onClose={() => setCurrentVar(undefined)}
/>
</div>
<div className='grow overflow-y-auto rounded-b-2xl px-4'>
<div className="grow overflow-y-auto rounded-b-2xl px-4">
{varList.map(chatVar => (
<VariableItem
key={chatVar.id}

View File

@ -1,28 +1,28 @@
import type { StartNodeType } from '../../nodes/start/types'
import type { ChatWrapperRefType } from './index'
import type { ChatItem, OnSend } from '@/app/components/base/chat/types'
import type { FileEntity } from '@/app/components/base/file-uploader/types'
import { memo, useCallback, useEffect, useImperativeHandle, useMemo } from 'react'
import { useNodes } from 'reactflow'
import { BlockEnum } from '../../types'
import {
useStore,
useWorkflowStore,
} from '../../store'
import type { StartNodeType } from '../../nodes/start/types'
import Empty from './empty'
import UserInput from './user-input'
import ConversationVariableModal from './conversation-variable-modal'
import { useChat } from './hooks'
import type { ChatWrapperRefType } from './index'
import { useStore as useAppStore } from '@/app/components/app/store'
import Chat from '@/app/components/base/chat/chat'
import type { ChatItem, OnSend } from '@/app/components/base/chat/types'
import { getLastAnswer, isValidGeneratedAnswer } from '@/app/components/base/chat/utils'
import { useFeatures } from '@/app/components/base/features/hooks'
import { EVENT_WORKFLOW_STOP } from '@/app/components/workflow/variable-inspect/types'
import { useEventEmitterContextContext } from '@/context/event-emitter'
import {
fetchSuggestedQuestions,
stopChatMessageResponding,
} from '@/service/debug'
import { useStore as useAppStore } from '@/app/components/app/store'
import { getLastAnswer, isValidGeneratedAnswer } from '@/app/components/base/chat/utils'
import type { FileEntity } from '@/app/components/base/file-uploader/types'
import { useEventEmitterContextContext } from '@/context/event-emitter'
import { EVENT_WORKFLOW_STOP } from '@/app/components/workflow/variable-inspect/types'
import {
useStore,
useWorkflowStore,
} from '../../store'
import { BlockEnum } from '../../types'
import ConversationVariableModal from './conversation-variable-modal'
import Empty from './empty'
import { useChat } from './hooks'
import UserInput from './user-input'
type ChatWrapperProps = {
showConversationVariableModal: boolean
@ -39,7 +39,7 @@ const ChatWrapper = (
showInputsFieldsPanel,
onHide,
}: ChatWrapperProps & {
ref: React.RefObject<ChatWrapperRefType>;
ref: React.RefObject<ChatWrapperRefType>
},
) => {
const nodes = useNodes<StartNodeType>()
@ -118,11 +118,7 @@ const ChatWrapper = (
const doRegenerate = useCallback((chatItem: ChatItem, editedQuestion?: { message: string, files?: FileEntity[] }) => {
const question = editedQuestion ? chatItem : chatList.find(item => item.id === chatItem.parentMessageId)!
const parentAnswer = chatList.find(item => item.id === question.parentMessageId)
doSend(editedQuestion ? editedQuestion.message : question.content,
editedQuestion ? editedQuestion.files : question.message_files,
true,
isValidGeneratedAnswer(parentAnswer) ? parentAnswer : null,
)
doSend(editedQuestion ? editedQuestion.message : question.content, editedQuestion ? editedQuestion.files : question.message_files, true, isValidGeneratedAnswer(parentAnswer) ? parentAnswer : null)
}, [chatList, doSend])
const { eventEmitter } = useEventEmitterContextContext()
@ -160,10 +156,10 @@ const ChatWrapper = (
} as any}
chatList={chatList}
isResponding={isResponding}
chatContainerClassName='px-3'
chatContainerInnerClassName='pt-6 w-full max-w-full mx-auto'
chatFooterClassName='px-4 rounded-bl-2xl'
chatFooterInnerClassName='pb-0'
chatContainerClassName="px-3"
chatContainerInnerClassName="pt-6 w-full max-w-full mx-auto"
chatFooterClassName="px-4 rounded-bl-2xl"
chatFooterInnerClassName="pb-0"
showFileUpload
showFeatureBar
onFeatureBarClick={setShowFeaturesPanel}
@ -185,7 +181,7 @@ const ChatWrapper = (
noSpacing
suggestedQuestions={suggestedQuestions}
showPromptLog
chatAnswerContainerInner='!pr-2'
chatAnswerContainerInner="!pr-2"
switchSibling={setTargetMessageId}
/>
{showConversationVariableModal && (

View File

@ -1,27 +1,26 @@
'use client'
import React, { useCallback } from 'react'
import { useMount } from 'ahooks'
import { useTranslation } from 'react-i18next'
import { capitalize } from 'lodash-es'
import copy from 'copy-to-clipboard'
import type {
ConversationVariable,
} from '@/app/components/workflow/types'
import { RiCloseLine } from '@remixicon/react'
import Modal from '@/app/components/base/modal'
import { BubbleX } from '@/app/components/base/icons/src/vender/line/others'
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
import { useMount } from 'ahooks'
import copy from 'copy-to-clipboard'
import { capitalize, noop } from 'lodash-es'
import React, { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import {
Copy,
CopyCheck,
} from '@/app/components/base/icons/src/vender/line/files'
import { useStore } from '@/app/components/workflow/store'
import type {
ConversationVariable,
} from '@/app/components/workflow/types'
import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type'
import { BubbleX } from '@/app/components/base/icons/src/vender/line/others'
import Modal from '@/app/components/base/modal'
import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor'
import { CodeLanguage } from '@/app/components/workflow/nodes/code/types'
import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type'
import { useStore } from '@/app/components/workflow/store'
import useTimestamp from '@/hooks/use-timestamp'
import { fetchCurrentValueOfConversationVariable } from '@/service/workflow'
import { cn } from '@/utils/classnames'
import { noop } from 'lodash-es'
export type Props = {
conversationID: string
@ -80,14 +79,14 @@ const ConversationVariableModal = ({
onClose={noop}
className={cn('h-[640px] w-[920px] max-w-[920px] p-0')}
>
<div className='absolute right-4 top-4 cursor-pointer p-2' onClick={onHide}>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
<div className="absolute right-4 top-4 cursor-pointer p-2" onClick={onHide}>
<RiCloseLine className="h-4 w-4 text-text-tertiary" />
</div>
<div className='flex h-full w-full'>
<div className="flex h-full w-full">
{/* LEFT */}
<div className='flex h-full w-[224px] shrink-0 flex-col border-r border-divider-burn bg-background-sidenav-bg'>
<div className='system-xl-semibold shrink-0 pb-3 pl-5 pr-4 pt-5 text-text-primary'>{t('workflow.chatVariable.panelTitle')}</div>
<div className='grow overflow-y-auto px-3 py-2'>
<div className="flex h-full w-[224px] shrink-0 flex-col border-r border-divider-burn bg-background-sidenav-bg">
<div className="system-xl-semibold shrink-0 pb-3 pl-5 pr-4 pt-5 text-text-primary">{t('workflow.chatVariable.panelTitle')}</div>
<div className="grow overflow-y-auto px-3 py-2">
{varList.map(chatVar => (
<div key={chatVar.id} className={cn('radius-md group mb-0.5 flex cursor-pointer items-center p-2 hover:bg-state-base-hover', currentVar.id === chatVar.id && 'bg-state-base-hover')} onClick={() => setCurrentVar(chatVar)}>
<BubbleX className={cn('mr-1 h-4 w-4 shrink-0 text-text-tertiary group-hover:text-util-colors-teal-teal-700', currentVar.id === chatVar.id && 'text-util-colors-teal-teal-700')} />
@ -97,40 +96,46 @@ const ConversationVariableModal = ({
</div>
</div>
{/* RIGHT */}
<div className='flex h-full w-0 grow flex-col bg-components-panel-bg'>
<div className='shrink-0 p-4 pb-2'>
<div className='flex items-center gap-1 py-1'>
<div className='system-xl-semibold text-text-primary'>{currentVar.name}</div>
<div className='system-xs-medium text-text-tertiary'>{capitalize(currentVar.value_type)}</div>
<div className="flex h-full w-0 grow flex-col bg-components-panel-bg">
<div className="shrink-0 p-4 pb-2">
<div className="flex items-center gap-1 py-1">
<div className="system-xl-semibold text-text-primary">{currentVar.name}</div>
<div className="system-xs-medium text-text-tertiary">{capitalize(currentVar.value_type)}</div>
</div>
</div>
<div className='flex h-0 grow flex-col p-4 pt-2'>
<div className='mb-2 flex shrink-0 items-center gap-2'>
<div className='system-xs-medium-uppercase shrink-0 text-text-tertiary'>{t('workflow.chatVariable.storedContent').toLocaleUpperCase()}</div>
<div className='h-px grow' style={{
background: 'linear-gradient(to right, rgba(16, 24, 40, 0.08) 0%, rgba(255, 255, 255) 100%)',
}}></div>
<div className="flex h-0 grow flex-col p-4 pt-2">
<div className="mb-2 flex shrink-0 items-center gap-2">
<div className="system-xs-medium-uppercase shrink-0 text-text-tertiary">{t('workflow.chatVariable.storedContent').toLocaleUpperCase()}</div>
<div
className="h-px grow"
style={{
background: 'linear-gradient(to right, rgba(16, 24, 40, 0.08) 0%, rgba(255, 255, 255) 100%)',
}}
>
</div>
{latestValueTimestampMap[currentVar.id] && (
<div className='system-xs-regular shrink-0 text-text-tertiary'>{t('workflow.chatVariable.updatedAt')}{formatTime(latestValueTimestampMap[currentVar.id], t('appLog.dateTimeFormat') as string)}</div>
<div className="system-xs-regular shrink-0 text-text-tertiary">
{t('workflow.chatVariable.updatedAt')}
{formatTime(latestValueTimestampMap[currentVar.id], t('appLog.dateTimeFormat') as string)}
</div>
)}
</div>
<div className='grow overflow-y-auto'>
<div className="grow overflow-y-auto">
{currentVar.value_type !== ChatVarType.Number && currentVar.value_type !== ChatVarType.String && (
<div className='flex h-full flex-col rounded-lg bg-components-input-bg-normal px-2 pb-2'>
<div className='flex h-7 shrink-0 items-center justify-between pl-3 pr-2 pt-1'>
<div className='system-xs-semibold text-text-secondary'>JSON</div>
<div className='flex items-center p-1'>
<div className="flex h-full flex-col rounded-lg bg-components-input-bg-normal px-2 pb-2">
<div className="flex h-7 shrink-0 items-center justify-between pl-3 pr-2 pt-1">
<div className="system-xs-semibold text-text-secondary">JSON</div>
<div className="flex items-center p-1">
{!isCopied
? (
<Copy className='h-4 w-4 cursor-pointer text-text-tertiary' onClick={handleCopy} />
)
<Copy className="h-4 w-4 cursor-pointer text-text-tertiary" onClick={handleCopy} />
)
: (
<CopyCheck className='h-4 w-4 text-text-tertiary' />
)
}
<CopyCheck className="h-4 w-4 text-text-tertiary" />
)}
</div>
</div>
<div className='grow pl-4'>
<div className="grow pl-4">
<CodeEditor
readOnly
noWrapper
@ -143,7 +148,7 @@ const ConversationVariableModal = ({
</div>
)}
{(currentVar.value_type === ChatVarType.Number || currentVar.value_type === ChatVarType.String) && (
<div className='system-md-regular h-full overflow-y-auto overflow-x-hidden rounded-lg bg-components-input-bg-normal px-4 py-3 text-components-input-text-filled'>{latestValueMap[currentVar.id] || ''}</div>
<div className="system-md-regular h-full overflow-y-auto overflow-x-hidden rounded-lg bg-components-input-bg-normal px-4 py-3 text-components-input-text-filled">{latestValueMap[currentVar.id] || ''}</div>
)}
</div>
</div>

View File

@ -5,11 +5,11 @@ const Empty = () => {
const { t } = useTranslation()
return (
<div className='absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2'>
<div className='mb-2 flex justify-center'>
<ChatBotSlim className='h-12 w-12 text-gray-300' />
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
<div className="mb-2 flex justify-center">
<ChatBotSlim className="h-12 w-12 text-gray-300" />
</div>
<div className='w-[256px] text-center text-[13px] text-gray-400'>
<div className="w-[256px] text-center text-[13px] text-gray-400">
{t('workflow.common.previewPlaceholder')}
</div>
</div>

View File

@ -1,3 +1,12 @@
import type { InputForm } from '@/app/components/base/chat/chat/type'
import type {
ChatItem,
ChatItemInTree,
Inputs,
} from '@/app/components/base/chat/types'
import type { FileEntity } from '@/app/components/base/file-uploader/types'
import { produce, setAutoFreeze } from 'immer'
import { uniqBy } from 'lodash-es'
import {
useCallback,
useEffect,
@ -6,35 +15,26 @@ import {
useState,
} from 'react'
import { useTranslation } from 'react-i18next'
import { produce, setAutoFreeze } from 'immer'
import { uniqBy } from 'lodash-es'
import {
useSetWorkflowVarsWithValue,
useWorkflowRun,
} from '../../hooks'
import { NodeRunningStatus, WorkflowRunningStatus } from '../../types'
import { useWorkflowStore } from '../../store'
import { DEFAULT_ITER_TIMES, DEFAULT_LOOP_TIMES } from '../../constants'
import type {
ChatItem,
ChatItemInTree,
Inputs,
} from '@/app/components/base/chat/types'
import type { InputForm } from '@/app/components/base/chat/chat/type'
import {
getProcessedInputs,
processOpeningStatement,
} from '@/app/components/base/chat/chat/utils'
import { useToastContext } from '@/app/components/base/toast'
import { TransferMethod } from '@/types/app'
import { getThreadMessages } from '@/app/components/base/chat/utils'
import {
getProcessedFiles,
getProcessedFilesFromResponse,
} from '@/app/components/base/file-uploader/utils'
import type { FileEntity } from '@/app/components/base/file-uploader/types'
import { getThreadMessages } from '@/app/components/base/chat/utils'
import { useToastContext } from '@/app/components/base/toast'
import { useInvalidAllLastRun } from '@/service/use-workflow'
import { TransferMethod } from '@/types/app'
import { DEFAULT_ITER_TIMES, DEFAULT_LOOP_TIMES } from '../../constants'
import {
useSetWorkflowVarsWithValue,
useWorkflowRun,
} from '../../hooks'
import { useHooksStore } from '../../hooks-store'
import { useWorkflowStore } from '../../store'
import { NodeRunningStatus, WorkflowRunningStatus } from '../../types'
type GetAbortController = (abortController: AbortController) => void
type SendCallback = {

View File

@ -1,3 +1,7 @@
import type { StartNodeType } from '../../nodes/start/types'
import { RiCloseLine, RiEqualizer2Line } from '@remixicon/react'
import { debounce, noop } from 'lodash-es'
import {
memo,
useCallback,
@ -5,25 +9,21 @@ import {
useRef,
useState,
} from 'react'
import { RiCloseLine, RiEqualizer2Line } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import { useNodes } from 'reactflow'
import ActionButton, { ActionButtonState } from '@/app/components/base/action-button'
import { RefreshCcw01 } from '@/app/components/base/icons/src/vender/line/arrows'
import Tooltip from '@/app/components/base/tooltip'
import { useEdgesInteractionsWithoutSync } from '@/app/components/workflow/hooks/use-edges-interactions-without-sync'
import { useNodesInteractionsWithoutSync } from '@/app/components/workflow/hooks/use-nodes-interactions-without-sync'
import { useStore } from '@/app/components/workflow/store'
import { cn } from '@/utils/classnames'
import {
useWorkflowInteractions,
} from '../../hooks'
import { useEdgesInteractionsWithoutSync } from '@/app/components/workflow/hooks/use-edges-interactions-without-sync'
import { useNodesInteractionsWithoutSync } from '@/app/components/workflow/hooks/use-nodes-interactions-without-sync'
import { BlockEnum } from '../../types'
import type { StartNodeType } from '../../nodes/start/types'
import { useResizePanel } from '../../nodes/_base/hooks/use-resize-panel'
import { BlockEnum } from '../../types'
import ChatWrapper from './chat-wrapper'
import { cn } from '@/utils/classnames'
import { RefreshCcw01 } from '@/app/components/base/icons/src/vender/line/arrows'
import Tooltip from '@/app/components/base/tooltip'
import ActionButton, { ActionButtonState } from '@/app/components/base/action-button'
import { useStore } from '@/app/components/workflow/store'
import { debounce, noop } from 'lodash-es'
export type ChatWrapperRefType = {
handleRestart: () => void
@ -81,11 +81,12 @@ const DebugAndPreview = () => {
})
return (
<div className='relative h-full'>
<div className="relative h-full">
<div
ref={triggerRef}
className='absolute -left-1 top-0 flex h-full w-1 cursor-col-resize resize-x items-center justify-center'>
<div className='h-10 w-0.5 rounded-sm bg-state-base-handle hover:h-full hover:bg-state-accent-solid active:h-full active:bg-state-accent-solid'></div>
className="absolute -left-1 top-0 flex h-full w-1 cursor-col-resize resize-x items-center justify-center"
>
<div className="h-10 w-0.5 rounded-sm bg-state-base-handle hover:h-full hover:bg-state-accent-solid active:h-full active:bg-state-accent-solid"></div>
</div>
<div
ref={containerRef}
@ -94,38 +95,38 @@ const DebugAndPreview = () => {
)}
style={{ width: `${panelWidth}px` }}
>
<div className='system-xl-semibold flex shrink-0 items-center justify-between px-4 pb-2 pt-3 text-text-primary'>
<div className='h-8'>{t('workflow.common.debugAndPreview').toLocaleUpperCase()}</div>
<div className='flex items-center gap-1'>
<div className="system-xl-semibold flex shrink-0 items-center justify-between px-4 pb-2 pt-3 text-text-primary">
<div className="h-8">{t('workflow.common.debugAndPreview').toLocaleUpperCase()}</div>
<div className="flex items-center gap-1">
<Tooltip
popupContent={t('common.operation.refresh')}
>
<ActionButton onClick={() => handleRestartChat()}>
<RefreshCcw01 className='h-4 w-4' />
<RefreshCcw01 className="h-4 w-4" />
</ActionButton>
</Tooltip>
{visibleVariables.length > 0 && (
<div className='relative'>
<div className="relative">
<Tooltip
popupContent={t('workflow.panel.userInputField')}
>
<ActionButton state={expanded ? ActionButtonState.Active : undefined} onClick={() => setExpanded(!expanded)}>
<RiEqualizer2Line className='h-4 w-4' />
<RiEqualizer2Line className="h-4 w-4" />
</ActionButton>
</Tooltip>
{expanded && <div className='absolute bottom-[-17px] right-[5px] z-10 h-3 w-3 rotate-45 border-l-[0.5px] border-t-[0.5px] border-components-panel-border-subtle bg-components-panel-on-panel-item-bg' />}
{expanded && <div className="absolute bottom-[-17px] right-[5px] z-10 h-3 w-3 rotate-45 border-l-[0.5px] border-t-[0.5px] border-components-panel-border-subtle bg-components-panel-on-panel-item-bg" />}
</div>
)}
<div className='mx-3 h-3.5 w-[1px] bg-divider-regular'></div>
<div className="mx-3 h-3.5 w-[1px] bg-divider-regular"></div>
<div
className='flex h-6 w-6 cursor-pointer items-center justify-center'
className="flex h-6 w-6 cursor-pointer items-center justify-center"
onClick={handleCancelDebugAndPreviewPanel}
>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
<RiCloseLine className="h-4 w-4 text-text-tertiary" />
</div>
</div>
</div>
<div className='grow overflow-y-auto rounded-b-2xl'>
<div className="grow overflow-y-auto rounded-b-2xl">
<ChatWrapper
ref={chatRef}
showConversationVariableModal={showConversationVariableModal}

View File

@ -1,15 +1,15 @@
import type { StartNodeType } from '../../nodes/start/types'
import {
memo,
} from 'react'
import { useNodes } from 'reactflow'
import { cn } from '@/utils/classnames'
import FormItem from '../../nodes/_base/components/before-run-form/form-item'
import { BlockEnum } from '../../types'
import {
useStore,
useWorkflowStore,
} from '../../store'
import type { StartNodeType } from '../../nodes/start/types'
import { cn } from '@/utils/classnames'
import { BlockEnum } from '../../types'
const UserInput = () => {
const workflowStore = useWorkflowStore()
@ -36,11 +36,11 @@ const UserInput = () => {
return (
<div className={cn('relative z-[1] rounded-xl border-[0.5px] border-components-panel-border-subtle bg-components-panel-on-panel-item-bg shadow-xs')}>
<div className='px-4 pb-4 pt-3'>
<div className="px-4 pb-4 pt-3">
{visibleVariables.map((variable, index) => (
<div
key={variable.variable}
className='mb-4 last-of-type:mb-0'
className="mb-4 last-of-type:mb-0"
>
<FormItem
autoFocus={index === 0}

View File

@ -1,9 +1,9 @@
import { memo, useState } from 'react'
import { capitalize } from 'lodash-es'
import type { EnvironmentVariable } from '@/app/components/workflow/types'
import { RiDeleteBinLine, RiEditLine, RiLock2Line } from '@remixicon/react'
import { capitalize } from 'lodash-es'
import { memo, useState } from 'react'
import { Env } from '@/app/components/base/icons/src/vender/line/others'
import { useStore } from '@/app/components/workflow/store'
import type { EnvironmentVariable } from '@/app/components/workflow/types'
import { cn } from '@/utils/classnames'
type EnvItemProps = {
@ -24,37 +24,36 @@ const EnvItem = ({
<div className={cn(
'radius-md group mb-1 border border-components-panel-border-subtle bg-components-panel-on-panel-item-bg shadow-xs hover:bg-components-panel-on-panel-item-bg-hover',
destructive && 'border-state-destructive-border hover:bg-state-destructive-hover',
)}>
<div className='px-2.5 py-2'>
<div className='flex items-center justify-between'>
<div className='flex grow items-center gap-1'>
<Env className='h-4 w-4 text-util-colors-violet-violet-600' />
<div className='system-sm-medium text-text-primary'>{env.name}</div>
<div className='system-xs-medium text-text-tertiary'>{capitalize(env.value_type)}</div>
{env.value_type === 'secret' && <RiLock2Line className='h-3 w-3 text-text-tertiary' />}
)}
>
<div className="px-2.5 py-2">
<div className="flex items-center justify-between">
<div className="flex grow items-center gap-1">
<Env className="h-4 w-4 text-util-colors-violet-violet-600" />
<div className="system-sm-medium text-text-primary">{env.name}</div>
<div className="system-xs-medium text-text-tertiary">{capitalize(env.value_type)}</div>
{env.value_type === 'secret' && <RiLock2Line className="h-3 w-3 text-text-tertiary" />}
</div>
<div className='flex shrink-0 items-center gap-1 text-text-tertiary'>
<div className='radius-md cursor-pointer p-1 hover:bg-state-base-hover hover:text-text-secondary'>
<RiEditLine className='h-4 w-4' onClick={() => onEdit(env)}/>
<div className="flex shrink-0 items-center gap-1 text-text-tertiary">
<div className="radius-md cursor-pointer p-1 hover:bg-state-base-hover hover:text-text-secondary">
<RiEditLine className="h-4 w-4" onClick={() => onEdit(env)} />
</div>
<div
className='radius-md cursor-pointer p-1 hover:bg-state-destructive-hover hover:text-text-destructive'
className="radius-md cursor-pointer p-1 hover:bg-state-destructive-hover hover:text-text-destructive"
onMouseOver={() => setDestructive(true)}
onMouseOut={() => setDestructive(false)}
>
<RiDeleteBinLine className='h-4 w-4' onClick={() => onDelete(env)} />
<RiDeleteBinLine className="h-4 w-4" onClick={() => onDelete(env)} />
</div>
</div>
</div>
<div className='system-xs-regular truncate text-text-tertiary'>{env.value_type === 'secret' ? envSecrets[env.id] : env.value}</div>
<div className="system-xs-regular truncate text-text-tertiary">{env.value_type === 'secret' ? envSecrets[env.id] : env.value}</div>
</div>
{env.description && (
<>
<div className={'h-[0.5px] bg-divider-subtle'} />
<div className={cn('rounded-bl-[8px] rounded-br-[8px] bg-background-default-subtle px-2.5 py-2 group-hover:bg-transparent',
destructive && 'bg-state-destructive-hover hover:bg-state-destructive-hover',
)}>
<div className='system-xs-regular truncate text-text-tertiary'>{env.description}</div>
<div className="h-[0.5px] bg-divider-subtle" />
<div className={cn('rounded-bl-[8px] rounded-br-[8px] bg-background-default-subtle px-2.5 py-2 group-hover:bg-transparent', destructive && 'bg-state-destructive-hover hover:bg-state-destructive-hover')}>
<div className="system-xs-regular truncate text-text-tertiary">{env.description}</div>
</div>
</>
)}

View File

@ -1,23 +1,23 @@
import type {
EnvironmentVariable,
} from '@/app/components/workflow/types'
import { RiCloseLine } from '@remixicon/react'
import {
memo,
useCallback,
useState,
} from 'react'
import { useTranslation } from 'react-i18next'
import {
useStoreApi,
} from 'reactflow'
import { RiCloseLine } from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import { useStore } from '@/app/components/workflow/store'
import VariableTrigger from '@/app/components/workflow/panel/env-panel/variable-trigger'
import EnvItem from '@/app/components/workflow/panel/env-panel/env-item'
import type {
EnvironmentVariable,
} from '@/app/components/workflow/types'
import { findUsedVarNodes, updateNodeVars } from '@/app/components/workflow/nodes/_base/components/variable/utils'
import RemoveEffectVarConfirm from '@/app/components/workflow/nodes/_base/components/remove-effect-var-confirm'
import { cn } from '@/utils/classnames'
import { useNodesSyncDraft } from '@/app/components/workflow/hooks/use-nodes-sync-draft'
import RemoveEffectVarConfirm from '@/app/components/workflow/nodes/_base/components/remove-effect-var-confirm'
import { findUsedVarNodes, updateNodeVars } from '@/app/components/workflow/nodes/_base/components/variable/utils'
import EnvItem from '@/app/components/workflow/panel/env-panel/env-item'
import VariableTrigger from '@/app/components/workflow/panel/env-panel/variable-trigger'
import { useStore } from '@/app/components/workflow/store'
import { cn } from '@/utils/classnames'
const EnvPanel = () => {
const { t } = useTranslation()
@ -152,19 +152,19 @@ const EnvPanel = () => {
'relative flex h-full w-[420px] flex-col rounded-l-2xl border border-components-panel-border bg-components-panel-bg-alt',
)}
>
<div className='system-xl-semibold flex shrink-0 items-center justify-between p-4 pb-0 text-text-primary'>
<div className="system-xl-semibold flex shrink-0 items-center justify-between p-4 pb-0 text-text-primary">
{t('workflow.env.envPanelTitle')}
<div className='flex items-center'>
<div className="flex items-center">
<div
className='flex h-6 w-6 cursor-pointer items-center justify-center'
className="flex h-6 w-6 cursor-pointer items-center justify-center"
onClick={() => setShowEnvPanel(false)}
>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
<RiCloseLine className="h-4 w-4 text-text-tertiary" />
</div>
</div>
</div>
<div className='system-sm-regular shrink-0 px-4 py-1 text-text-tertiary'>{t('workflow.env.envDescription')}</div>
<div className='shrink-0 px-4 pb-3 pt-2'>
<div className="system-sm-regular shrink-0 px-4 py-1 text-text-tertiary">{t('workflow.env.envDescription')}</div>
<div className="shrink-0 px-4 pb-3 pt-2">
<VariableTrigger
open={showVariableModal}
setOpen={setShowVariableModal}
@ -173,7 +173,7 @@ const EnvPanel = () => {
onClose={() => setCurrentVar(undefined)}
/>
</div>
<div className='grow overflow-y-auto rounded-b-2xl px-4'>
<div className="grow overflow-y-auto rounded-b-2xl px-4">
{envList.map(env => (
<EnvItem
key={env.id}

View File

@ -1,14 +1,14 @@
import type { EnvironmentVariable } from '@/app/components/workflow/types'
import { RiCloseLine } from '@remixicon/react'
import React, { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import { v4 as uuid4 } from 'uuid'
import { RiCloseLine } from '@remixicon/react'
import { useContext } from 'use-context-selector'
import { v4 as uuid4 } from 'uuid'
import Button from '@/app/components/base/button'
import Input from '@/app/components/base/input'
import Tooltip from '@/app/components/base/tooltip'
import { ToastContext } from '@/app/components/base/toast'
import Tooltip from '@/app/components/base/tooltip'
import { useStore } from '@/app/components/workflow/store'
import type { EnvironmentVariable } from '@/app/components/workflow/types'
import { cn } from '@/utils/classnames'
import { checkKeys, replaceSpaceWithUnderscoreInVarNameInput } from '@/utils/var'
@ -86,89 +86,107 @@ const VariableModal = ({
<div
className={cn('flex h-full w-[360px] flex-col rounded-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-2xl')}
>
<div className='system-xl-semibold mb-3 flex shrink-0 items-center justify-between p-4 pb-0 text-text-primary'>
<div className="system-xl-semibold mb-3 flex shrink-0 items-center justify-between p-4 pb-0 text-text-primary">
{!env ? t('workflow.env.modal.title') : t('workflow.env.modal.editTitle')}
<div className='flex items-center'>
<div className="flex items-center">
<div
className='flex h-6 w-6 cursor-pointer items-center justify-center'
className="flex h-6 w-6 cursor-pointer items-center justify-center"
onClick={onClose}
>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
<RiCloseLine className="h-4 w-4 text-text-tertiary" />
</div>
</div>
</div>
<div className='px-4 py-2'>
<div className="px-4 py-2">
{/* type */}
<div className='mb-4'>
<div className='system-sm-semibold mb-1 flex h-6 items-center text-text-secondary'>{t('workflow.env.modal.type')}</div>
<div className='flex gap-2'>
<div className={cn(
'radius-md system-sm-regular flex w-[106px] cursor-pointer items-center justify-center border border-components-option-card-option-border bg-components-option-card-option-bg p-2 text-text-secondary hover:border-components-option-card-option-border-hover hover:bg-components-option-card-option-bg-hover hover:shadow-xs',
type === 'string' && 'system-sm-medium border-[1.5px] border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg text-text-primary shadow-xs hover:border-components-option-card-option-selected-border',
)} onClick={() => setType('string')}>String</div>
<div className={cn(
'radius-md system-sm-regular flex w-[106px] cursor-pointer items-center justify-center border border-components-option-card-option-border bg-components-option-card-option-bg p-2 text-text-secondary hover:border-components-option-card-option-border-hover hover:bg-components-option-card-option-bg-hover hover:shadow-xs',
type === 'number' && 'border-[1.5px] border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg font-medium text-text-primary shadow-xs hover:border-components-option-card-option-selected-border',
)} onClick={() => {
setType('number')
if (!(/^\d$/).test(value))
setValue('')
}}>Number</div>
<div className={cn(
'radius-md system-sm-regular flex w-[106px] cursor-pointer items-center justify-center border border-components-option-card-option-border bg-components-option-card-option-bg p-2 text-text-secondary hover:border-components-option-card-option-border-hover hover:bg-components-option-card-option-bg-hover hover:shadow-xs',
type === 'secret' && 'border-[1.5px] border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg font-medium text-text-primary shadow-xs hover:border-components-option-card-option-selected-border',
)} onClick={() => setType('secret')}>
<div className="mb-4">
<div className="system-sm-semibold mb-1 flex h-6 items-center text-text-secondary">{t('workflow.env.modal.type')}</div>
<div className="flex gap-2">
<div
className={cn(
'radius-md system-sm-regular flex w-[106px] cursor-pointer items-center justify-center border border-components-option-card-option-border bg-components-option-card-option-bg p-2 text-text-secondary hover:border-components-option-card-option-border-hover hover:bg-components-option-card-option-bg-hover hover:shadow-xs',
type === 'string' && 'system-sm-medium border-[1.5px] border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg text-text-primary shadow-xs hover:border-components-option-card-option-selected-border',
)}
onClick={() => setType('string')}
>
String
</div>
<div
className={cn(
'radius-md system-sm-regular flex w-[106px] cursor-pointer items-center justify-center border border-components-option-card-option-border bg-components-option-card-option-bg p-2 text-text-secondary hover:border-components-option-card-option-border-hover hover:bg-components-option-card-option-bg-hover hover:shadow-xs',
type === 'number' && 'border-[1.5px] border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg font-medium text-text-primary shadow-xs hover:border-components-option-card-option-selected-border',
)}
onClick={() => {
setType('number')
if (!(/^\d$/).test(value))
setValue('')
}}
>
Number
</div>
<div
className={cn(
'radius-md system-sm-regular flex w-[106px] cursor-pointer items-center justify-center border border-components-option-card-option-border bg-components-option-card-option-bg p-2 text-text-secondary hover:border-components-option-card-option-border-hover hover:bg-components-option-card-option-bg-hover hover:shadow-xs',
type === 'secret' && 'border-[1.5px] border-components-option-card-option-selected-border bg-components-option-card-option-selected-bg font-medium text-text-primary shadow-xs hover:border-components-option-card-option-selected-border',
)}
onClick={() => setType('secret')}
>
<span>Secret</span>
<Tooltip
popupContent={
<div className='w-[240px]'>
popupContent={(
<div className="w-[240px]">
{t('workflow.env.modal.secretTip')}
</div>
}
triggerClassName='ml-0.5 w-3.5 h-3.5'
)}
triggerClassName="ml-0.5 w-3.5 h-3.5"
/>
</div>
</div>
</div>
{/* name */}
<div className='mb-4'>
<div className='system-sm-semibold mb-1 flex h-6 items-center text-text-secondary'>{t('workflow.env.modal.name')}</div>
<div className='flex'>
<div className="mb-4">
<div className="system-sm-semibold mb-1 flex h-6 items-center text-text-secondary">{t('workflow.env.modal.name')}</div>
<div className="flex">
<Input
placeholder={t('workflow.env.modal.namePlaceholder') || ''}
value={name}
onChange={handleVarNameChange}
onBlur={e => checkVariableName(e.target.value)}
type='text'
type="text"
/>
</div>
</div>
{/* value */}
<div className='mb-4'>
<div className='system-sm-semibold mb-1 flex h-6 items-center text-text-secondary'>{t('workflow.env.modal.value')}</div>
<div className='flex'>
<div className="mb-4">
<div className="system-sm-semibold mb-1 flex h-6 items-center text-text-secondary">{t('workflow.env.modal.value')}</div>
<div className="flex">
{
type !== 'number' ? <textarea
className='system-sm-regular placeholder:system-sm-regular block h-20 w-full resize-none appearance-none rounded-lg border border-transparent bg-components-input-bg-normal p-2 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs'
value={value}
placeholder={t('workflow.env.modal.valuePlaceholder') || ''}
onChange={e => setValue(e.target.value)}
/>
: <Input
placeholder={t('workflow.env.modal.valuePlaceholder') || ''}
value={value}
onChange={e => setValue(e.target.value)}
type="number"
/>
type !== 'number'
? (
<textarea
className="system-sm-regular placeholder:system-sm-regular block h-20 w-full resize-none appearance-none rounded-lg border border-transparent bg-components-input-bg-normal p-2 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs"
value={value}
placeholder={t('workflow.env.modal.valuePlaceholder') || ''}
onChange={e => setValue(e.target.value)}
/>
)
: (
<Input
placeholder={t('workflow.env.modal.valuePlaceholder') || ''}
value={value}
onChange={e => setValue(e.target.value)}
type="number"
/>
)
}
</div>
</div>
{/* description */}
<div className=''>
<div className='system-sm-semibold mb-1 flex h-6 items-center text-text-secondary'>{t('workflow.env.modal.description')}</div>
<div className='flex'>
<div className="">
<div className="system-sm-semibold mb-1 flex h-6 items-center text-text-secondary">{t('workflow.env.modal.description')}</div>
<div className="flex">
<textarea
className='system-sm-regular placeholder:system-sm-regular block h-20 w-full resize-none appearance-none rounded-lg border border-transparent bg-components-input-bg-normal p-2 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs'
className="system-sm-regular placeholder:system-sm-regular block h-20 w-full resize-none appearance-none rounded-lg border border-transparent bg-components-input-bg-normal p-2 text-components-input-text-filled caret-primary-600 outline-none placeholder:text-components-input-text-placeholder hover:border-components-input-border-hover hover:bg-components-input-bg-hover focus:border-components-input-border-active focus:bg-components-input-bg-active focus:shadow-xs"
value={description}
placeholder={t('workflow.env.modal.descriptionPlaceholder') || ''}
onChange={e => setDescription(e.target.value)}
@ -176,10 +194,10 @@ const VariableModal = ({
</div>
</div>
</div>
<div className='flex flex-row-reverse rounded-b-2xl p-4 pt-2'>
<div className='flex gap-2'>
<div className="flex flex-row-reverse rounded-b-2xl p-4 pt-2">
<div className="flex gap-2">
<Button onClick={onClose}>{t('common.operation.cancel')}</Button>
<Button variant='primary' onClick={handleSave}>{t('common.operation.save')}</Button>
<Button variant="primary" onClick={handleSave}>{t('common.operation.save')}</Button>
</div>
</div>
</div>

View File

@ -1,15 +1,15 @@
'use client'
import type { EnvironmentVariable } from '@/app/components/workflow/types'
import { RiAddLine } from '@remixicon/react'
import React from 'react'
import { useTranslation } from 'react-i18next'
import { RiAddLine } from '@remixicon/react'
import Button from '@/app/components/base/button'
import VariableModal from '@/app/components/workflow/panel/env-panel/variable-modal'
import {
PortalToFollowElem,
PortalToFollowElemContent,
PortalToFollowElemTrigger,
} from '@/app/components/base/portal-to-follow-elem'
import type { EnvironmentVariable } from '@/app/components/workflow/types'
import VariableModal from '@/app/components/workflow/panel/env-panel/variable-modal'
type Props = {
open: boolean
@ -36,7 +36,7 @@ const VariableTrigger = ({
if (open)
onClose()
}}
placement='left-start'
placement="left-start"
offset={{
mainAxis: 8,
alignmentAxis: -104,
@ -46,13 +46,14 @@ const VariableTrigger = ({
setOpen(v => !v)
if (open)
onClose()
}}>
<Button variant='primary'>
<RiAddLine className='mr-1 h-4 w-4' />
<span className='system-sm-medium'>{t('workflow.env.envPanelButton')}</span>
}}
>
<Button variant="primary">
<RiAddLine className="mr-1 h-4 w-4" />
<span className="system-sm-medium">{t('workflow.env.envPanelButton')}</span>
</Button>
</PortalToFollowElemTrigger>
<PortalToFollowElemContent className='z-[11]'>
<PortalToFollowElemContent className="z-[11]">
<VariableModal
env={env}
onSave={onSave}

View File

@ -1,16 +1,16 @@
import type { GlobalVariable } from '../../types'
import { RiCloseLine } from '@remixicon/react'
import {
memo,
} from 'react'
import { RiCloseLine } from '@remixicon/react'
import type { GlobalVariable } from '../../types'
import Item from './item'
import { useTranslation } from 'react-i18next'
import { useStore } from '@/app/components/workflow/store'
import { cn } from '@/utils/classnames'
import { useTranslation } from 'react-i18next'
import { useIsChatMode } from '../../hooks'
import { isInWorkflowPage } from '../../constants'
import { useIsChatMode } from '../../hooks'
import Item from './item'
const Panel = () => {
const { t } = useTranslation()
@ -19,16 +19,17 @@ const Panel = () => {
const isWorkflowPage = isInWorkflowPage()
const globalVariableList: GlobalVariable[] = [
...(isChatMode ? [{
name: 'conversation_id',
value_type: 'string' as const,
description: t('workflow.globalVar.fieldsDescription.conversationId'),
},
{
name: 'dialog_count',
value_type: 'number' as const,
description: t('workflow.globalVar.fieldsDescription.dialogCount'),
}] : []),
...(isChatMode
? [{
name: 'conversation_id',
value_type: 'string' as const,
description: t('workflow.globalVar.fieldsDescription.conversationId'),
}, {
name: 'dialog_count',
value_type: 'number' as const,
description: t('workflow.globalVar.fieldsDescription.dialogCount'),
}]
: []),
{
name: 'user_id',
value_type: 'string',
@ -50,11 +51,13 @@ const Panel = () => {
description: t('workflow.globalVar.fieldsDescription.workflowRunId'),
},
// is workflow
...((isWorkflowPage && !isChatMode) ? [{
name: 'timestamp',
value_type: 'number' as const,
description: t('workflow.globalVar.fieldsDescription.triggerTimestamp'),
}] : []),
...((isWorkflowPage && !isChatMode)
? [{
name: 'timestamp',
value_type: 'number' as const,
description: t('workflow.globalVar.fieldsDescription.triggerTimestamp'),
}]
: []),
]
return (
@ -63,20 +66,20 @@ const Panel = () => {
'relative flex h-full w-[420px] flex-col rounded-l-2xl border border-components-panel-border bg-components-panel-bg-alt',
)}
>
<div className='system-xl-semibold flex shrink-0 items-center justify-between p-4 pb-0 text-text-primary'>
<div className="system-xl-semibold flex shrink-0 items-center justify-between p-4 pb-0 text-text-primary">
{t('workflow.globalVar.title')}
<div className='flex items-center'>
<div className="flex items-center">
<div
className='flex h-6 w-6 cursor-pointer items-center justify-center'
className="flex h-6 w-6 cursor-pointer items-center justify-center"
onClick={() => setShowPanel(false)}
>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
<RiCloseLine className="h-4 w-4 text-text-tertiary" />
</div>
</div>
</div>
<div className='system-sm-regular shrink-0 px-4 py-1 text-text-tertiary'>{t('workflow.globalVar.description')}</div>
<div className="system-sm-regular shrink-0 px-4 py-1 text-text-tertiary">{t('workflow.globalVar.description')}</div>
<div className='mt-4 grow overflow-y-auto rounded-b-2xl px-4'>
<div className="mt-4 grow overflow-y-auto rounded-b-2xl px-4">
{globalVariableList.map(item => (
<Item
key={item.name}

View File

@ -1,8 +1,8 @@
import { memo } from 'react'
import { capitalize } from 'lodash-es'
import { GlobalVariable as GlobalVariableIcon } from '@/app/components/base/icons/src/vender/line/others'
import type { GlobalVariable } from '@/app/components/workflow/types'
import { capitalize } from 'lodash-es'
import { memo } from 'react'
import { GlobalVariable as GlobalVariableIcon } from '@/app/components/base/icons/src/vender/line/others'
import { cn } from '@/utils/classnames'
type Props = {
@ -15,18 +15,19 @@ const Item = ({
return (
<div className={cn(
'radius-md mb-1 border border-components-panel-border-subtle bg-components-panel-on-panel-item-bg px-2.5 py-2 shadow-xs hover:bg-components-panel-on-panel-item-bg-hover',
)}>
<div className='flex items-center justify-between'>
<div className='flex grow items-center gap-1'>
<GlobalVariableIcon className='h-4 w-4 text-util-colors-orange-orange-600' />
<div className='system-sm-medium text-text-primary'>
<span className='text-text-tertiary'>sys.</span>
)}
>
<div className="flex items-center justify-between">
<div className="flex grow items-center gap-1">
<GlobalVariableIcon className="h-4 w-4 text-util-colors-orange-orange-600" />
<div className="system-sm-medium text-text-primary">
<span className="text-text-tertiary">sys.</span>
{payload.name}
</div>
<div className='system-xs-medium text-text-tertiary'>{capitalize(payload.value_type)}</div>
<div className="system-xs-medium text-text-tertiary">{capitalize(payload.value_type)}</div>
</div>
</div>
<div className='system-xs-regular mt-1.5 truncate text-text-tertiary'>{payload.description}</div>
<div className="system-xs-regular mt-1.5 truncate text-text-tertiary">{payload.description}</div>
</div>
)
}

View File

@ -1,13 +1,13 @@
import type { FC } from 'react'
import { memo, useCallback, useEffect, useRef } from 'react'
import type { VersionHistoryPanelProps } from '@/app/components/workflow/panel/version-history-panel'
import { useShallow } from 'zustand/react/shallow'
import dynamic from 'next/dynamic'
import { memo, useCallback, useEffect, useRef } from 'react'
import { useStore as useReactflow } from 'reactflow'
import { useShallow } from 'zustand/react/shallow'
import { cn } from '@/utils/classnames'
import { Panel as NodePanel } from '../nodes'
import { useStore } from '../store'
import EnvPanel from './env-panel'
import { cn } from '@/utils/classnames'
import dynamic from 'next/dynamic'
const VersionHistoryPanel = dynamic(() => import('@/app/components/workflow/panel/version-history-panel'), {
ssr: false,
@ -44,7 +44,8 @@ const useResizeObserver = (
useEffect(() => {
const element = elementRef.current
if (!element) return
if (!element)
return
const resizeObserver = new ResizeObserver((entries) => {
for (const entry of entries) {

View File

@ -1,3 +1,4 @@
import type { StartNodeType } from '../nodes/start/types'
import {
memo,
useCallback,
@ -5,25 +6,24 @@ import {
} from 'react'
import { useTranslation } from 'react-i18next'
import { useNodes } from 'reactflow'
import Button from '@/app/components/base/button'
import { useCheckInputsForms } from '@/app/components/base/chat/chat/check-input-forms-hooks'
import {
getProcessedInputs,
} from '@/app/components/base/chat/chat/utils'
import { TransferMethod } from '../../base/text-generation/types'
import { useWorkflowRun } from '../hooks'
import { useHooksStore } from '../hooks-store'
import FormItem from '../nodes/_base/components/before-run-form/form-item'
import {
useStore,
useWorkflowStore,
} from '../store'
import {
BlockEnum,
InputVarType,
WorkflowRunningStatus,
} from '../types'
import {
useStore,
useWorkflowStore,
} from '../store'
import { useWorkflowRun } from '../hooks'
import type { StartNodeType } from '../nodes/start/types'
import { TransferMethod } from '../../base/text-generation/types'
import Button from '@/app/components/base/button'
import {
getProcessedInputs,
} from '@/app/components/base/chat/chat/utils'
import { useCheckInputsForms } from '@/app/components/base/chat/chat/check-input-forms-hooks'
import { useHooksStore } from '../hooks-store'
type Props = {
onRun: () => void
@ -105,16 +105,16 @@ const InputsPanel = ({ onRun }: Props) => {
return (
<>
<div className='px-4 pb-2 pt-3'>
<div className="px-4 pb-2 pt-3">
{
variables.map((variable, index) => (
<div
key={variable.variable}
className='mb-2 last-of-type:mb-0'
className="mb-2 last-of-type:mb-0"
>
<FormItem
autoFocus={index === 0}
className='!block'
className="!block"
payload={variable}
value={initialInputs[variable.variable]}
onChange={v => handleValueChange(variable.variable, v)}
@ -123,11 +123,11 @@ const InputsPanel = ({ onRun }: Props) => {
))
}
</div>
<div className='flex items-center justify-between px-4 py-2'>
<div className="flex items-center justify-between px-4 py-2">
<Button
variant='primary'
variant="primary"
disabled={!canRun || workflowRunningData?.result?.status === WorkflowRunningStatus.Running}
className='w-full'
className="w-full"
onClick={doRun}
>
{t('workflow.singleRun.startRun')}

View File

@ -1,9 +1,9 @@
import { memo, useCallback } from 'react'
import type { WorkflowRunDetailResponse } from '@/models/log'
import Run from '../run'
import { useStore } from '../store'
import { memo, useCallback } from 'react'
import { useWorkflowUpdate } from '../hooks'
import { useHooksStore } from '../hooks-store'
import Run from '../run'
import { useStore } from '../store'
import { formatWorkflowRunIdentifier } from '../utils'
const Record = () => {
@ -21,8 +21,8 @@ const Record = () => {
}, [handleUpdateWorkflowCanvas])
return (
<div className='flex h-full w-[400px] flex-col rounded-l-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-xl'>
<div className='system-xl-semibold flex items-center justify-between p-4 pb-0 text-text-primary'>
<div className="flex h-full w-[400px] flex-col rounded-l-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-xl">
<div className="system-xl-semibold flex items-center justify-between p-4 pb-0 text-text-primary">
{`Test Run${formatWorkflowRunIdentifier(historyWorkflowData?.finished_at)}`}
</div>
<Run

View File

@ -1,15 +1,16 @@
import React, { type FC, useCallback } from 'react'
import type { FC } from 'react'
import { RiMoreFill } from '@remixicon/react'
import { VersionHistoryContextMenuOptions } from '../../../types'
import MenuItem from './menu-item'
import useContextMenu from './use-context-menu'
import React, { useCallback } from 'react'
import Button from '@/app/components/base/button'
import Divider from '@/app/components/base/divider'
import {
PortalToFollowElem,
PortalToFollowElemContent,
PortalToFollowElemTrigger,
} from '@/app/components/base/portal-to-follow-elem'
import Button from '@/app/components/base/button'
import Divider from '@/app/components/base/divider'
import { VersionHistoryContextMenuOptions } from '../../../types'
import MenuItem from './menu-item'
import useContextMenu from './use-context-menu'
export type ContextMenuProps = {
isShowDelete: boolean
@ -33,7 +34,7 @@ const ContextMenu: FC<ContextMenuProps> = (props: ContextMenuProps) => {
return (
<PortalToFollowElem
placement={'bottom-end'}
placement="bottom-end"
offset={{
mainAxis: 4,
crossAxis: 0,
@ -42,13 +43,13 @@ const ContextMenu: FC<ContextMenuProps> = (props: ContextMenuProps) => {
onOpenChange={setOpen}
>
<PortalToFollowElemTrigger>
<Button size='small' className='px-1' onClick={handleClickTrigger}>
<RiMoreFill className='h-4 w-4' />
<Button size="small" className="px-1" onClick={handleClickTrigger}>
<RiMoreFill className="h-4 w-4" />
</Button>
</PortalToFollowElemTrigger>
<PortalToFollowElemContent className='z-10'>
<div className='flex w-[184px] flex-col rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]'>
<div className='flex flex-col p-1'>
<PortalToFollowElemContent className="z-10">
<div className="flex w-[184px] flex-col rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]">
<div className="flex flex-col p-1">
{
options.map((option) => {
return (
@ -64,8 +65,8 @@ const ContextMenu: FC<ContextMenuProps> = (props: ContextMenuProps) => {
{
isShowDelete && (
<>
<Divider type='horizontal' className='my-0 h-px bg-divider-subtle' />
<div className='p-1'>
<Divider type="horizontal" className="my-0 h-px bg-divider-subtle" />
<div className="p-1">
<MenuItem
item={deleteOperation}
isDestructive

View File

@ -1,5 +1,6 @@
import React, { type FC } from 'react'
import type { FC } from 'react'
import type { VersionHistoryContextMenuOptions } from '../../../types'
import React from 'react'
import { cn } from '@/utils/classnames'
type MenuItemProps = {
@ -29,7 +30,8 @@ const MenuItem: FC<MenuItemProps> = ({
<div className={cn(
'system-md-regular flex-1 text-text-primary',
isDestructive && 'hover:text-text-destructive',
)}>
)}
>
{item.name}
</div>
</div>

View File

@ -1,8 +1,8 @@
import type { ContextMenuProps } from './index'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { VersionHistoryContextMenuOptions } from '../../../types'
import type { ContextMenuProps } from './index'
import { useStore } from '@/app/components/workflow/store'
import { VersionHistoryContextMenuOptions } from '../../../types'
const useContextMenu = (props: ContextMenuProps) => {
const {
@ -24,18 +24,20 @@ const useContextMenu = (props: ContextMenuProps) => {
},
isNamedVersion
? {
key: VersionHistoryContextMenuOptions.edit,
name: t('workflow.versionHistory.editVersionInfo'),
}
key: VersionHistoryContextMenuOptions.edit,
name: t('workflow.versionHistory.editVersionInfo'),
}
: {
key: VersionHistoryContextMenuOptions.edit,
name: t('workflow.versionHistory.nameThisVersion'),
},
key: VersionHistoryContextMenuOptions.edit,
name: t('workflow.versionHistory.nameThisVersion'),
},
// todo: pipeline support export specific version DSL
...(!pipelineId ? [{
key: VersionHistoryContextMenuOptions.exportDSL,
name: t('app.export'),
}] : []),
...(!pipelineId
? [{
key: VersionHistoryContextMenuOptions.exportDSL,
name: t('app.export'),
}]
: []),
{
key: VersionHistoryContextMenuOptions.copyId,
name: t('workflow.versionHistory.copyId'),

View File

@ -1,8 +1,9 @@
import React, { type FC } from 'react'
import Modal from '@/app/components/base/modal'
import type { FC } from 'react'
import type { VersionHistory } from '@/types/workflow'
import React from 'react'
import { useTranslation } from 'react-i18next'
import Button from '@/app/components/base/button'
import Modal from '@/app/components/base/modal'
type DeleteConfirmModalProps = {
isOpen: boolean
@ -19,24 +20,26 @@ const DeleteConfirmModal: FC<DeleteConfirmModalProps> = ({
}) => {
const { t } = useTranslation()
return <Modal className='p-0' isShow={isOpen} onClose={onClose}>
<div className='flex flex-col gap-y-2 p-6 pb-4 '>
<div className='title-2xl-semi-bold text-text-primary'>
{`${t('common.operation.delete')} ${versionInfo.marked_name || t('workflow.versionHistory.defaultName')}`}
return (
<Modal className="p-0" isShow={isOpen} onClose={onClose}>
<div className="flex flex-col gap-y-2 p-6 pb-4 ">
<div className="title-2xl-semi-bold text-text-primary">
{`${t('common.operation.delete')} ${versionInfo.marked_name || t('workflow.versionHistory.defaultName')}`}
</div>
<p className="system-md-regular text-text-secondary">
{t('workflow.versionHistory.deletionTip')}
</p>
</div>
<p className='system-md-regular text-text-secondary'>
{t('workflow.versionHistory.deletionTip')}
</p>
</div>
<div className='flex items-center justify-end gap-x-2 p-6'>
<Button onClick={onClose}>
{t('common.operation.cancel')}
</Button>
<Button variant='warning' onClick={onDelete.bind(null, versionInfo.id)}>
{t('common.operation.delete')}
</Button>
</div>
</Modal>
<div className="flex items-center justify-end gap-x-2 p-6">
<Button onClick={onClose}>
{t('common.operation.cancel')}
</Button>
<Button variant="warning" onClick={onDelete.bind(null, versionInfo.id)}>
{t('common.operation.delete')}
</Button>
</div>
</Modal>
)
}
export default DeleteConfirmModal

View File

@ -1,7 +1,8 @@
import Button from '@/app/components/base/button'
import type { FC } from 'react'
import { RiHistoryLine } from '@remixicon/react'
import React, { type FC } from 'react'
import React from 'react'
import { useTranslation } from 'react-i18next'
import Button from '@/app/components/base/button'
type EmptyProps = {
onResetFilter: () => void
@ -12,19 +13,21 @@ const Empty: FC<EmptyProps> = ({
}) => {
const { t } = useTranslation()
return <div className='flex h-5/6 w-full flex-col justify-center gap-y-2'>
<div className='flex justify-center'>
<RiHistoryLine className='h-10 w-10 text-text-empty-state-icon' />
return (
<div className="flex h-5/6 w-full flex-col justify-center gap-y-2">
<div className="flex justify-center">
<RiHistoryLine className="h-10 w-10 text-text-empty-state-icon" />
</div>
<div className="system-xs-regular flex justify-center text-text-tertiary">
{t('workflow.versionHistory.filter.empty')}
</div>
<div className="flex justify-center">
<Button size="small" onClick={onResetFilter}>
{t('workflow.versionHistory.filter.reset')}
</Button>
</div>
</div>
<div className='system-xs-regular flex justify-center text-text-tertiary'>
{t('workflow.versionHistory.filter.empty')}
</div>
<div className='flex justify-center'>
<Button size='small' onClick={onResetFilter}>
{t('workflow.versionHistory.filter.reset')}
</Button>
</div>
</div>
)
}
export default React.memo(Empty)

View File

@ -1,6 +1,7 @@
import { RiCheckLine } from '@remixicon/react'
import React, { type FC } from 'react'
import type { FC } from 'react'
import type { WorkflowVersionFilterOptions } from '../../../types'
import { RiCheckLine } from '@remixicon/react'
import React from 'react'
type FilterItemProps = {
item: {
@ -18,13 +19,13 @@ const FilterItem: FC<FilterItemProps> = ({
}) => {
return (
<div
className='flex cursor-pointer items-center justify-between gap-x-1 rounded-lg px-2 py-1.5 hover:bg-state-base-hover'
className="flex cursor-pointer items-center justify-between gap-x-1 rounded-lg px-2 py-1.5 hover:bg-state-base-hover"
onClick={() => {
onClick(item.key)
}}
>
<div className='system-md-regular flex-1 text-text-primary'>{item.name}</div>
{isSelected && <RiCheckLine className='h-4 w-4 shrink-0 text-text-accent' />}
<div className="system-md-regular flex-1 text-text-primary">{item.name}</div>
{isSelected && <RiCheckLine className="h-4 w-4 shrink-0 text-text-accent" />}
</div>
)
}

View File

@ -1,4 +1,5 @@
import React, { type FC } from 'react'
import type { FC } from 'react'
import React from 'react'
import { useTranslation } from 'react-i18next'
import Switch from '@/app/components/base/switch'
@ -14,16 +15,16 @@ const FilterSwitch: FC<FilterSwitchProps> = ({
const { t } = useTranslation()
return (
<div className='flex items-center p-1'>
<div className='flex w-full items-center gap-x-1 px-2 py-1.5'>
<div className='system-md-regular flex-1 px-1 text-text-secondary'>
<div className="flex items-center p-1">
<div className="flex w-full items-center gap-x-1 px-2 py-1.5">
<div className="system-md-regular flex-1 px-1 text-text-secondary">
{t('workflow.versionHistory.filter.onlyShowNamedVersions')}
</div>
<Switch
defaultValue={enabled}
onChange={v => handleSwitch(v)}
size='md'
className='shrink-0'
size="md"
className="shrink-0"
/>
</div>
</div>

View File

@ -1,16 +1,17 @@
import React, { type FC, useCallback, useState } from 'react'
import type { FC } from 'react'
import { RiFilter3Line } from '@remixicon/react'
import { WorkflowVersionFilterOptions } from '../../../types'
import { useFilterOptions } from './use-filter'
import FilterItem from './filter-item'
import FilterSwitch from './filter-switch'
import React, { useCallback, useState } from 'react'
import Divider from '@/app/components/base/divider'
import {
PortalToFollowElem,
PortalToFollowElemContent,
PortalToFollowElemTrigger,
} from '@/app/components/base/portal-to-follow-elem'
import Divider from '@/app/components/base/divider'
import { cn } from '@/utils/classnames'
import { WorkflowVersionFilterOptions } from '../../../types'
import FilterItem from './filter-item'
import FilterSwitch from './filter-switch'
import { useFilterOptions } from './use-filter'
type FilterProps = {
filterValue: WorkflowVersionFilterOptions
@ -36,7 +37,7 @@ const Filter: FC<FilterProps> = ({
return (
<PortalToFollowElem
placement={'bottom-end'}
placement="bottom-end"
offset={{
mainAxis: 4,
crossAxis: 55,
@ -54,9 +55,9 @@ const Filter: FC<FilterProps> = ({
<RiFilter3Line className={cn('h-4 w-4', isFiltering ? 'text-text-accent' : ' text-text-tertiary')} />
</div>
</PortalToFollowElemTrigger>
<PortalToFollowElemContent className='z-[12]'>
<div className='flex w-[248px] flex-col rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]'>
<div className='flex flex-col p-1'>
<PortalToFollowElemContent className="z-[12]">
<div className="flex w-[248px] flex-col rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]">
<div className="flex flex-col p-1">
{
options.map((option) => {
return (
@ -70,7 +71,7 @@ const Filter: FC<FilterProps> = ({
})
}
</div>
<Divider type='horizontal' className='my-0 h-px bg-divider-subtle' />
<Divider type="horizontal" className="my-0 h-px bg-divider-subtle" />
<FilterSwitch enabled={isOnlyShowNamedVersions} handleSwitch={handleSwitch} />
</div>
</PortalToFollowElemContent>

View File

@ -1,24 +1,24 @@
'use client'
import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import type { VersionHistory } from '@/types/workflow'
import { RiArrowDownDoubleLine, RiCloseLine, RiLoader2Line } from '@remixicon/react'
import copy from 'copy-to-clipboard'
import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import VersionInfoModal from '@/app/components/app/app-publisher/version-info-modal'
import Divider from '@/app/components/base/divider'
import Toast from '@/app/components/base/toast'
import { useSelector as useAppContextSelector } from '@/context/app-context'
import { useDeleteWorkflow, useInvalidAllLastRun, useResetWorkflowVersionHistory, useUpdateWorkflow, useWorkflowVersionHistory } from '@/service/use-workflow'
import { useDSL, useNodesSyncDraft, useWorkflowRun } from '../../hooks'
import { useHooksStore } from '../../hooks-store'
import { useStore, useWorkflowStore } from '../../store'
import { VersionHistoryContextMenuOptions, WorkflowVersionFilterOptions } from '../../types'
import VersionHistoryItem from './version-history-item'
import Filter from './filter'
import type { VersionHistory } from '@/types/workflow'
import { useDeleteWorkflow, useInvalidAllLastRun, useResetWorkflowVersionHistory, useUpdateWorkflow, useWorkflowVersionHistory } from '@/service/use-workflow'
import Divider from '@/app/components/base/divider'
import Loading from './loading'
import Empty from './empty'
import { useSelector as useAppContextSelector } from '@/context/app-context'
import RestoreConfirmModal from './restore-confirm-modal'
import DeleteConfirmModal from './delete-confirm-modal'
import VersionInfoModal from '@/app/components/app/app-publisher/version-info-modal'
import Toast from '@/app/components/base/toast'
import { useHooksStore } from '../../hooks-store'
import Empty from './empty'
import Filter from './filter'
import Loading from './loading'
import RestoreConfirmModal from './restore-confirm-modal'
import VersionHistoryItem from './version-history-item'
const HISTORY_PER_PAGE = 10
const INITIAL_PAGE = 1
@ -222,87 +222,95 @@ export const VersionHistoryPanel = ({
}, [t, updateWorkflow, resetWorkflowVersionHistory, updateVersionUrl])
return (
<div className='flex h-full w-[268px] flex-col rounded-l-2xl border-y-[0.5px] border-l-[0.5px] border-components-panel-border bg-components-panel-bg shadow-xl shadow-shadow-shadow-5'>
<div className='flex items-center gap-x-2 px-4 pt-3'>
<div className='system-xl-semibold flex-1 py-1 text-text-primary'>{t('workflow.versionHistory.title')}</div>
<div className="flex h-full w-[268px] flex-col rounded-l-2xl border-y-[0.5px] border-l-[0.5px] border-components-panel-border bg-components-panel-bg shadow-xl shadow-shadow-shadow-5">
<div className="flex items-center gap-x-2 px-4 pt-3">
<div className="system-xl-semibold flex-1 py-1 text-text-primary">{t('workflow.versionHistory.title')}</div>
<Filter
filterValue={filterValue}
isOnlyShowNamedVersions={isOnlyShowNamedVersions}
onClickFilterItem={handleClickFilterItem}
handleSwitch={handleSwitch}
/>
<Divider type='vertical' className='mx-1 h-3.5' />
<Divider type="vertical" className="mx-1 h-3.5" />
<div
className='flex h-6 w-6 cursor-pointer items-center justify-center p-0.5'
className="flex h-6 w-6 cursor-pointer items-center justify-center p-0.5"
onClick={handleClose}
>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
<RiCloseLine className="h-4 w-4 text-text-tertiary" />
</div>
</div>
<div className="flex h-0 flex-1 flex-col">
<div className="flex-1 overflow-y-auto px-3 py-2">
{(isFetching && !versionHistory?.pages?.length)
? (
<Loading />
)
<Loading />
)
: (
<>
{versionHistory?.pages?.map((page, pageNumber) => (
page.items?.map((item, idx) => {
const isLast = pageNumber === versionHistory.pages.length - 1 && idx === page.items.length - 1
return <VersionHistoryItem
key={item.id}
item={item}
currentVersion={currentVersion}
latestVersionId={latestVersionId || ''}
onClick={handleVersionClick}
handleClickMenuItem={handleClickMenuItem.bind(null, item)}
isLast={isLast}
/>
})
))}
{!isFetching && (!versionHistory?.pages?.length || !versionHistory.pages[0].items.length) && (
<Empty onResetFilter={handleResetFilter} />
)}
</>
)}
<>
{versionHistory?.pages?.map((page, pageNumber) => (
page.items?.map((item, idx) => {
const isLast = pageNumber === versionHistory.pages.length - 1 && idx === page.items.length - 1
return (
<VersionHistoryItem
key={item.id}
item={item}
currentVersion={currentVersion}
latestVersionId={latestVersionId || ''}
onClick={handleVersionClick}
handleClickMenuItem={handleClickMenuItem.bind(null, item)}
isLast={isLast}
/>
)
})
))}
{!isFetching && (!versionHistory?.pages?.length || !versionHistory.pages[0].items.length) && (
<Empty onResetFilter={handleResetFilter} />
)}
</>
)}
</div>
{hasNextPage && (
<div className='p-2'>
<div className="p-2">
<div
className='flex cursor-pointer items-center gap-x-1'
className="flex cursor-pointer items-center gap-x-1"
onClick={handleNextPage}
>
<div className='item-center flex justify-center p-0.5'>
<div className="item-center flex justify-center p-0.5">
{isFetching
? <RiLoader2Line className='h-3.5 w-3.5 animate-spin text-text-accent' />
: <RiArrowDownDoubleLine className='h-3.5 w-3.5 text-text-accent' />}
? <RiLoader2Line className="h-3.5 w-3.5 animate-spin text-text-accent" />
: <RiArrowDownDoubleLine className="h-3.5 w-3.5 text-text-accent" />}
</div>
<div className='system-xs-medium-uppercase py-[1px] text-text-accent'>
<div className="system-xs-medium-uppercase py-[1px] text-text-accent">
{t('workflow.common.loadMore')}
</div>
</div>
</div>
)}
</div>
{restoreConfirmOpen && (<RestoreConfirmModal
isOpen={restoreConfirmOpen}
versionInfo={operatedItem!}
onClose={handleCancel.bind(null, VersionHistoryContextMenuOptions.restore)}
onRestore={handleRestore}
/>)}
{deleteConfirmOpen && (<DeleteConfirmModal
isOpen={deleteConfirmOpen}
versionInfo={operatedItem!}
onClose={handleCancel.bind(null, VersionHistoryContextMenuOptions.delete)}
onDelete={handleDelete}
/>)}
{editModalOpen && (<VersionInfoModal
isOpen={editModalOpen}
versionInfo={operatedItem}
onClose={handleCancel.bind(null, VersionHistoryContextMenuOptions.edit)}
onPublish={handleUpdateWorkflow}
/>)}
{restoreConfirmOpen && (
<RestoreConfirmModal
isOpen={restoreConfirmOpen}
versionInfo={operatedItem!}
onClose={handleCancel.bind(null, VersionHistoryContextMenuOptions.restore)}
onRestore={handleRestore}
/>
)}
{deleteConfirmOpen && (
<DeleteConfirmModal
isOpen={deleteConfirmOpen}
versionInfo={operatedItem!}
onClose={handleCancel.bind(null, VersionHistoryContextMenuOptions.delete)}
onDelete={handleDelete}
/>
)}
{editModalOpen && (
<VersionInfoModal
isOpen={editModalOpen}
versionInfo={operatedItem}
onClose={handleCancel.bind(null, VersionHistoryContextMenuOptions.edit)}
onPublish={handleUpdateWorkflow}
/>
)}
</div>
)
}

View File

@ -10,10 +10,12 @@ const itemConfig = Array.from({ length: 8 }).map((_, index) => {
})
const Loading = () => {
return <div className='relative w-full overflow-y-hidden'>
<div className='absolute left-0 top-0 z-10 h-full w-full bg-dataset-chunk-list-mask-bg' />
{itemConfig.map((config, index) => <Item key={index} {...config} />)}
</div>
return (
<div className="relative w-full overflow-y-hidden">
<div className="absolute left-0 top-0 z-10 h-full w-full bg-dataset-chunk-list-mask-bg" />
{itemConfig.map((config, index) => <Item key={index} {...config} />)}
</div>
)
}
export default Loading

View File

@ -1,4 +1,5 @@
import React, { type FC } from 'react'
import type { FC } from 'react'
import React from 'react'
import { cn } from '@/utils/classnames'
type ItemProps = {
@ -15,18 +16,18 @@ const Item: FC<ItemProps> = ({
isLast,
}) => {
return (
<div className='relative flex gap-x-1 p-2' >
{!isLast && <div className='absolute left-4 top-6 h-[calc(100%-0.75rem)] w-0.5 bg-divider-subtle' />}
<div className=' flex h-5 w-[18px] shrink-0 items-center justify-center'>
<div className='h-2 w-2 rounded-lg border-[2px] border-text-quaternary' />
<div className="relative flex gap-x-1 p-2">
{!isLast && <div className="absolute left-4 top-6 h-[calc(100%-0.75rem)] w-0.5 bg-divider-subtle" />}
<div className=" flex h-5 w-[18px] shrink-0 items-center justify-center">
<div className="h-2 w-2 rounded-lg border-[2px] border-text-quaternary" />
</div>
<div className='flex grow flex-col gap-y-0.5'>
<div className='flex h-3.5 items-center'>
<div className="flex grow flex-col gap-y-0.5">
<div className="flex h-3.5 items-center">
<div className={cn('h-2 w-full rounded-sm bg-text-quaternary opacity-20', titleWidth)} />
</div>
{
!isFirst && (
<div className='flex h-3 items-center'>
<div className="flex h-3 items-center">
<div className={cn('h-1.5 w-full rounded-sm bg-text-quaternary opacity-20', releaseNotesWidth)} />
</div>
)

View File

@ -1,8 +1,9 @@
import React, { type FC } from 'react'
import Modal from '@/app/components/base/modal'
import type { FC } from 'react'
import type { VersionHistory } from '@/types/workflow'
import React from 'react'
import { useTranslation } from 'react-i18next'
import Button from '@/app/components/base/button'
import Modal from '@/app/components/base/modal'
type RestoreConfirmModalProps = {
isOpen: boolean
@ -19,24 +20,26 @@ const RestoreConfirmModal: FC<RestoreConfirmModalProps> = ({
}) => {
const { t } = useTranslation()
return <Modal className='p-0' isShow={isOpen} onClose={onClose}>
<div className='flex flex-col gap-y-2 p-6 pb-4 '>
<div className='title-2xl-semi-bold text-text-primary'>
{`${t('workflow.common.restore')} ${versionInfo.marked_name || t('workflow.versionHistory.defaultName')}`}
return (
<Modal className="p-0" isShow={isOpen} onClose={onClose}>
<div className="flex flex-col gap-y-2 p-6 pb-4 ">
<div className="title-2xl-semi-bold text-text-primary">
{`${t('workflow.common.restore')} ${versionInfo.marked_name || t('workflow.versionHistory.defaultName')}`}
</div>
<p className="system-md-regular text-text-secondary">
{t('workflow.versionHistory.restorationTip')}
</p>
</div>
<p className='system-md-regular text-text-secondary'>
{t('workflow.versionHistory.restorationTip')}
</p>
</div>
<div className='flex items-center justify-end gap-x-2 p-6'>
<Button onClick={onClose}>
{t('common.operation.cancel')}
</Button>
<Button variant='primary' onClick={onRestore.bind(null, versionInfo)}>
{t('workflow.common.restore')}
</Button>
</div>
</Modal>
<div className="flex items-center justify-end gap-x-2 p-6">
<Button onClick={onClose}>
{t('common.operation.cancel')}
</Button>
<Button variant="primary" onClick={onRestore.bind(null, versionInfo)}>
{t('workflow.common.restore')}
</Button>
</div>
</Modal>
)
}
export default RestoreConfirmModal

View File

@ -1,10 +1,11 @@
import React, { useEffect, useState } from 'react'
import dayjs from 'dayjs'
import { useTranslation } from 'react-i18next'
import ContextMenu from './context-menu'
import { cn } from '@/utils/classnames'
import type { VersionHistoryContextMenuOptions } from '../../types'
import type { VersionHistory } from '@/types/workflow'
import { type VersionHistoryContextMenuOptions, WorkflowVersion } from '../../types'
import dayjs from 'dayjs'
import React, { useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { cn } from '@/utils/classnames'
import { WorkflowVersion } from '../../types'
import ContextMenu from './context-menu'
type VersionHistoryItemProps = {
item: VersionHistory
@ -80,38 +81,41 @@ const VersionHistoryItem: React.FC<VersionHistoryItemProps> = ({
setOpen(true)
}}
>
{!isLast && <div className='absolute left-4 top-6 h-[calc(100%-0.75rem)] w-0.5 bg-divider-subtle' />}
<div className=' flex h-5 w-[18px] shrink-0 items-center justify-center'>
{!isLast && <div className="absolute left-4 top-6 h-[calc(100%-0.75rem)] w-0.5 bg-divider-subtle" />}
<div className=" flex h-5 w-[18px] shrink-0 items-center justify-center">
<div className={cn(
'h-2 w-2 rounded-lg border-[2px]',
isSelected ? 'border-text-accent' : 'border-text-quaternary',
)}/>
)}
/>
</div>
<div className='flex grow flex-col gap-y-0.5 overflow-hidden'>
<div className='mr-6 flex h-5 items-center gap-x-1'>
<div className="flex grow flex-col gap-y-0.5 overflow-hidden">
<div className="mr-6 flex h-5 items-center gap-x-1">
<div className={cn(
'system-sm-semibold truncate py-[1px]',
isSelected ? 'text-text-accent' : 'text-text-secondary',
)}>
)}
>
{isDraft ? t('workflow.versionHistory.currentDraft') : item.marked_name || t('workflow.versionHistory.defaultName')}
</div>
{isLatest && (
<div className='system-2xs-medium-uppercase flex h-5 shrink-0 items-center rounded-md border border-text-accent-secondary
bg-components-badge-bg-dimm px-[5px] text-text-accent-secondary'>
<div className="system-2xs-medium-uppercase flex h-5 shrink-0 items-center rounded-md border border-text-accent-secondary
bg-components-badge-bg-dimm px-[5px] text-text-accent-secondary"
>
{t('workflow.versionHistory.latest')}
</div>
)}
</div>
{
!isDraft && (
<div className='system-xs-regular break-words text-text-secondary'>
<div className="system-xs-regular break-words text-text-secondary">
{item.marked_comment || ''}
</div>
)
}
{
!isDraft && (
<div className='system-xs-regular truncate text-text-tertiary'>
<div className="system-xs-regular truncate text-text-tertiary">
{`${formatTime(item.created_at)} · ${item.created_by.name}`}
</div>
)
@ -119,7 +123,7 @@ const VersionHistoryItem: React.FC<VersionHistoryItemProps> = ({
</div>
{/* Context Menu */}
{!isDraft && isHovering && (
<div className='absolute right-1 top-1'>
<div className="absolute right-1 top-1">
<ContextMenu
isShowDelete={!isLatest}
isNamedVersion={!!item.marked_name}

View File

@ -1,31 +1,31 @@
import {
RiClipboardLine,
RiCloseLine,
} from '@remixicon/react'
import copy from 'copy-to-clipboard'
import {
memo,
useCallback,
useEffect,
useState,
} from 'react'
import {
RiClipboardLine,
RiCloseLine,
} from '@remixicon/react'
import { useTranslation } from 'react-i18next'
import copy from 'copy-to-clipboard'
import ResultText from '../run/result-text'
import ResultPanel from '../run/result-panel'
import TracingPanel from '../run/tracing-panel'
import Button from '@/app/components/base/button'
import Loading from '@/app/components/base/loading'
import { cn } from '@/utils/classnames'
import Toast from '../../base/toast'
import {
useWorkflowInteractions,
} from '../hooks'
import ResultPanel from '../run/result-panel'
import ResultText from '../run/result-text'
import TracingPanel from '../run/tracing-panel'
import { useStore } from '../store'
import {
WorkflowRunningStatus,
} from '../types'
import { formatWorkflowRunIdentifier } from '../utils'
import Toast from '../../base/toast'
import InputsPanel from './inputs-panel'
import { cn } from '@/utils/classnames'
import Loading from '@/app/components/base/loading'
import Button from '@/app/components/base/button'
const WorkflowPreview = () => {
const { t } = useTranslation()
@ -95,23 +95,22 @@ const WorkflowPreview = () => {
}, [resize, stopResizing])
return (
<div className={
'relative flex h-full flex-col rounded-l-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-xl'
}
style={{ width: `${panelWidth}px` }}
<div
className="relative flex h-full flex-col rounded-l-2xl border-[0.5px] border-components-panel-border bg-components-panel-bg shadow-xl"
style={{ width: `${panelWidth}px` }}
>
<div
className="absolute bottom-0 left-[3px] top-1/2 z-50 h-6 w-[3px] cursor-col-resize rounded bg-gray-300"
onMouseDown={startResizing}
/>
<div className='flex items-center justify-between p-4 pb-1 text-base font-semibold text-text-primary'>
<div className="flex items-center justify-between p-4 pb-1 text-base font-semibold text-text-primary">
{`Test Run${formatWorkflowRunIdentifier(workflowRunningData?.result.finished_at)}`}
<div className='cursor-pointer p-1' onClick={() => handleCancelDebugAndPreviewPanel()}>
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
<div className="cursor-pointer p-1" onClick={() => handleCancelDebugAndPreviewPanel()}>
<RiCloseLine className="h-4 w-4 text-text-tertiary" />
</div>
</div>
<div className='relative flex grow flex-col'>
<div className='flex shrink-0 items-center border-b-[0.5px] border-divider-subtle px-4'>
<div className="relative flex grow flex-col">
<div className="flex shrink-0 items-center border-b-[0.5px] border-divider-subtle px-4">
{showInputsPanel && (
<div
className={cn(
@ -119,7 +118,9 @@ const WorkflowPreview = () => {
currentTab === 'INPUT' && '!border-[rgb(21,94,239)] text-text-secondary',
)}
onClick={() => switchTab('INPUT')}
>{t('runLog.input')}</div>
>
{t('runLog.input')}
</div>
)}
<div
className={cn(
@ -132,7 +133,9 @@ const WorkflowPreview = () => {
return
switchTab('RESULT')
}}
>{t('runLog.result')}</div>
>
{t('runLog.result')}
</div>
<div
className={cn(
'mr-6 cursor-pointer border-b-2 border-transparent py-3 text-[13px] font-semibold leading-[18px] text-text-tertiary',
@ -144,7 +147,9 @@ const WorkflowPreview = () => {
return
switchTab('DETAIL')
}}
>{t('runLog.detail')}</div>
>
{t('runLog.detail')}
</div>
<div
className={cn(
'mr-6 cursor-pointer border-b-2 border-transparent py-3 text-[13px] font-semibold leading-[18px] text-text-tertiary',
@ -156,12 +161,15 @@ const WorkflowPreview = () => {
return
switchTab('TRACING')
}}
>{t('runLog.tracing')}</div>
>
{t('runLog.tracing')}
</div>
</div>
<div className={cn(
'h-0 grow overflow-y-auto rounded-b-2xl bg-components-panel-bg',
(currentTab === 'RESULT' || currentTab === 'TRACING') && '!bg-background-section-burn',
)}>
)}
>
{currentTab === 'INPUT' && showInputsPanel && (
<InputsPanel onRun={() => switchTab('RESULT')} />
)}
@ -184,8 +192,9 @@ const WorkflowPreview = () => {
else
copy(JSON.stringify(content))
Toast.notify({ type: 'success', message: t('common.actionMsg.copySuccessfully') })
}}>
<RiClipboardLine className='h-3.5 w-3.5' />
}}
>
<RiClipboardLine className="h-3.5 w-3.5" />
<div>{t('common.operation.copy')}</div>
</Button>
)}
@ -211,18 +220,18 @@ const WorkflowPreview = () => {
/>
)}
{currentTab === 'DETAIL' && !workflowRunningData?.result && (
<div className='flex h-full items-center justify-center bg-components-panel-bg'>
<div className="flex h-full items-center justify-center bg-components-panel-bg">
<Loading />
</div>
)}
{currentTab === 'TRACING' && (
<TracingPanel
className='bg-background-section-burn'
className="bg-background-section-burn"
list={workflowRunningData?.tracing || []}
/>
)}
{currentTab === 'TRACING' && !workflowRunningData?.tracing?.length && (
<div className='flex h-full items-center justify-center !bg-background-section-burn'>
<div className="flex h-full items-center justify-center !bg-background-section-burn">
<Loading />
</div>
)}