feat: show workflow running status (#12531)

This commit is contained in:
crazywoola 2025-01-09 15:36:13 +08:00 committed by GitHub
parent f230a9232e
commit a085ad4719
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 10 deletions

View File

@ -306,8 +306,14 @@ const GenerationItem: FC<IGenerationItemProps> = ({
} }
<div className={`flex ${contentClassName}`}> <div className={`flex ${contentClassName}`}>
<div className='grow w-0'> <div className='grow w-0'>
{siteInfo && siteInfo.show_workflow_steps && workflowProcessData && ( {siteInfo && workflowProcessData && (
<WorkflowProcessItem data={workflowProcessData} expand={workflowProcessData.expand} hideProcessDetail={hideProcessDetail} /> <WorkflowProcessItem
data={workflowProcessData}
expand={workflowProcessData.expand}
hideProcessDetail={hideProcessDetail}
hideInfo={hideProcessDetail}
readonly={!siteInfo.show_workflow_steps}
/>
)} )}
{workflowProcessData && !isError && ( {workflowProcessData && !isError && (
<ResultTab data={workflowProcessData} content={content} currentTab={currentTab} onCurrentTabChange={setCurrentTab} /> <ResultTab data={workflowProcessData} content={content} currentTab={currentTab} onCurrentTabChange={setCurrentTab} />

View File

@ -13,7 +13,7 @@ import AgentContent from './agent-content'
import BasicContent from './basic-content' import BasicContent from './basic-content'
import SuggestedQuestions from './suggested-questions' import SuggestedQuestions from './suggested-questions'
import More from './more' 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 LoadingAnim from '@/app/components/base/chat/chat/loading-anim'
import Citation from '@/app/components/base/chat/chat/citation' import Citation from '@/app/components/base/chat/chat/citation'
import { EditTitle } from '@/app/components/app/annotation/edit-annotation-modal/edit-item' import { EditTitle } from '@/app/components/app/annotation/edit-annotation-modal/edit-item'
@ -133,7 +133,7 @@ const Answer: FC<AnswerProps> = ({
{/** Render the normal steps */} {/** Render the normal steps */}
{ {
workflowProcess && !hideProcessDetail && ( workflowProcess && !hideProcessDetail && (
<WorkflowProcess <WorkflowProcessItem
data={workflowProcess} data={workflowProcess}
item={item} item={item}
hideProcessDetail={hideProcessDetail} hideProcessDetail={hideProcessDetail}
@ -142,11 +142,12 @@ const Answer: FC<AnswerProps> = ({
} }
{/** Hide workflow steps by it's settings in siteInfo */} {/** Hide workflow steps by it's settings in siteInfo */}
{ {
workflowProcess && hideProcessDetail && appData && appData.site.show_workflow_steps && ( workflowProcess && hideProcessDetail && appData && (
<WorkflowProcess <WorkflowProcessItem
data={workflowProcess} data={workflowProcess}
item={item} item={item}
hideProcessDetail={hideProcessDetail} hideProcessDetail={hideProcessDetail}
readonly={!appData.site.show_workflow_steps}
/> />
) )
} }

View File

@ -23,6 +23,7 @@ type WorkflowProcessProps = {
expand?: boolean expand?: boolean
hideInfo?: boolean hideInfo?: boolean
hideProcessDetail?: boolean hideProcessDetail?: boolean
readonly?: boolean
} }
const WorkflowProcessItem = ({ const WorkflowProcessItem = ({
data, data,
@ -30,6 +31,7 @@ const WorkflowProcessItem = ({
expand = false, expand = false,
hideInfo = false, hideInfo = false,
hideProcessDetail = false, hideProcessDetail = false,
readonly = false,
}: WorkflowProcessProps) => { }: WorkflowProcessProps) => {
const { t } = useTranslation() const { t } = useTranslation()
const [collapse, setCollapse] = useState(!expand) const [collapse, setCollapse] = useState(!expand)
@ -81,8 +83,8 @@ const WorkflowProcessItem = ({
}} }}
> >
<div <div
className={cn('flex items-center cursor-pointer', !collapse && 'px-1.5')} className={cn('flex items-center cursor-pointer', !collapse && 'px-1.5', readonly && 'cursor-default')}
onClick={() => setCollapse(!collapse)} onClick={() => !readonly && setCollapse(!collapse)}
> >
{ {
running && ( running && (
@ -102,10 +104,10 @@ const WorkflowProcessItem = ({
<div className={cn('system-xs-medium text-text-secondary', !collapse && 'grow')}> <div className={cn('system-xs-medium text-text-secondary', !collapse && 'grow')}>
{t('workflow.common.workflowProcess')} {t('workflow.common.workflowProcess')}
</div> </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> </div>
{ {
!collapse && ( !collapse && !readonly && (
<div className='mt-1.5'> <div className='mt-1.5'>
{ {
<TracingPanel <TracingPanel