Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: show workflow running status (#12531)

crazywoolaa085ad47192b
diff --git a/web/app/components/app/text-generate/item/index.tsx b/web/app/components/app/text-generate/item/index.tsx
index ac868e6ee3c..3e2f837685e 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<IGenerationItemProps> = ({
}
<div className={`flex ${contentClassName}`}>
<div className='grow w-0'>
- {siteInfo && siteInfo.show_workflow_steps && workflowProcessData && (
- <WorkflowProcessItem data={workflowProcessData} expand={workflowProcessData.expand} hideProcessDetail={hideProcessDetail} />
+ {siteInfo && workflowProcessData && (
+ <WorkflowProcessItem
+ data={workflowProcessData}
+ expand={workflowProcessData.expand}
+ hideProcessDetail={hideProcessDetail}
+ hideInfo={hideProcessDetail}
+ readonly={!siteInfo.show_workflow_steps}
+ />
)}
{workflowProcessData && !isError && (
<ResultTab data={workflowProcessData} content={content} currentTab={currentTab} onCurrentTabChange={setCurrentTab} />
diff --git a/web/app/components/base/chat/chat/answer/index.tsx b/web/app/components/base/chat/chat/answer/index.tsx
index c6d14ddeade..2ceaf81e785 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<AnswerProps> = ({
{/** Render the normal steps */}
{
workflowProcess && !hideProcessDetail && (
- <WorkflowProcess
+ <WorkflowProcessItem
data={workflowProcess}
item={item}
hideProcessDetail={hideProcessDetail}
@@ -142,11 +142,12 @@ const Answer: FC<AnswerProps> = ({
}
{/** Hide workflow steps by it's settings in siteInfo */}
{
- workflowProcess && hideProcessDetail && appData && appData.site.show_workflow_steps && (
- <WorkflowProcess
+ workflowProcess && hideProcessDetail && appData && (
+ <WorkflowProcessItem
data={workflowProcess}
item={item}
hideProcessDetail={hideProcessDetail}
+ readonly={!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 bb9abdb6fcf..4dcac1aafc7 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 = ({
}}
>
<div
- className={cn('flex items-center cursor-pointer', !collapse && 'px-1.5')}
- onClick={() => 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 = ({
<div className={cn('system-xs-medium text-text-secondary', !collapse && 'grow')}>
{t('workflow.common.workflowProcess')}
</div>
- <RiArrowRightSLine className={`'ml-1 w-4 h-4 text-text-tertiary' ${collapse ? '' : 'rotate-90'}`} />
+ {!readonly && <RiArrowRightSLine className={`'ml-1 w-4 h-4 text-text-tertiary' ${collapse ? '' : 'rotate-90'}`} />}
</div>
{
- !collapse && (
+ !collapse && !readonly && (
<div className='mt-1.5'>
{
<TracingPanel