From a085ad47192b5a76f2d5587e226cf13d3f8a35bc Mon Sep 17 00:00:00 2001 From: crazywoola <100913391+crazywoola@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:36:13 +0800 Subject: [PATCH] feat: show workflow running status (#12531) --- web/app/components/app/text-generate/item/index.tsx | 10 ++++++++-- web/app/components/base/chat/chat/answer/index.tsx | 9 +++++---- .../base/chat/chat/answer/workflow-process.tsx | 10 ++++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/web/app/components/app/text-generate/item/index.tsx b/web/app/components/app/text-generate/item/index.tsx index ac868e6ee3c745..3e2f837685e4fb 100644 --- a/web/app/components/app/text-generate/item/index.tsx +++ b/web/app/components/app/text-generate/item/index.tsx @@ -306,8 +306,14 @@ const GenerationItem: FC = ({ }
- {siteInfo && siteInfo.show_workflow_steps && workflowProcessData && ( - + {siteInfo && workflowProcessData && ( + )} {workflowProcessData && !isError && ( diff --git a/web/app/components/base/chat/chat/answer/index.tsx b/web/app/components/base/chat/chat/answer/index.tsx index c6d14ddeade9e1..2ceaf81e785257 100644 --- a/web/app/components/base/chat/chat/answer/index.tsx +++ b/web/app/components/base/chat/chat/answer/index.tsx @@ -13,7 +13,7 @@ import AgentContent from './agent-content' import BasicContent from './basic-content' import SuggestedQuestions from './suggested-questions' import More from './more' -import WorkflowProcess from './workflow-process' +import WorkflowProcessItem from './workflow-process' import LoadingAnim from '@/app/components/base/chat/chat/loading-anim' import Citation from '@/app/components/base/chat/chat/citation' import { EditTitle } from '@/app/components/app/annotation/edit-annotation-modal/edit-item' @@ -133,7 +133,7 @@ const Answer: FC = ({ {/** Render the normal steps */} { workflowProcess && !hideProcessDetail && ( - = ({ } {/** Hide workflow steps by it's settings in siteInfo */} { - workflowProcess && hideProcessDetail && appData && appData.site.show_workflow_steps && ( - ) } diff --git a/web/app/components/base/chat/chat/answer/workflow-process.tsx b/web/app/components/base/chat/chat/answer/workflow-process.tsx index bb9abdb6fcf9b9..4dcac1aafc7eed 100644 --- a/web/app/components/base/chat/chat/answer/workflow-process.tsx +++ b/web/app/components/base/chat/chat/answer/workflow-process.tsx @@ -23,6 +23,7 @@ type WorkflowProcessProps = { expand?: boolean hideInfo?: boolean hideProcessDetail?: boolean + readonly?: boolean } const WorkflowProcessItem = ({ data, @@ -30,6 +31,7 @@ const WorkflowProcessItem = ({ expand = false, hideInfo = false, hideProcessDetail = false, + readonly = false, }: WorkflowProcessProps) => { const { t } = useTranslation() const [collapse, setCollapse] = useState(!expand) @@ -81,8 +83,8 @@ const WorkflowProcessItem = ({ }} >
setCollapse(!collapse)} + className={cn('flex items-center cursor-pointer', !collapse && 'px-1.5', readonly && 'cursor-default')} + onClick={() => !readonly && setCollapse(!collapse)} > { running && ( @@ -102,10 +104,10 @@ const WorkflowProcessItem = ({
{t('workflow.common.workflowProcess')}
- + {!readonly && }
{ - !collapse && ( + !collapse && !readonly && (
{