mirror of
https://github.com/langgenius/dify.git
synced 2026-05-13 08:57:28 +08:00
add run log status
This commit is contained in:
parent
cfb853efbf
commit
2be2bc5877
@ -25,14 +25,14 @@ const RunPanel: FC<RunProps> = ({ activeTab, appId }) => {
|
|||||||
currentTab === 'RESULT' && '!border-[rgb(21,94,239)] text-gray-700',
|
currentTab === 'RESULT' && '!border-[rgb(21,94,239)] text-gray-700',
|
||||||
)}
|
)}
|
||||||
onClick={() => setCurrentTab('RESULT')}
|
onClick={() => setCurrentTab('RESULT')}
|
||||||
>{t('appLog.runDetail.result')}</div>
|
>{t('runLog.result')}</div>
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
'mr-6 py-3 border-b-2 border-transparent text-[13px] font-semibold leading-[18px] text-gray-400 cursor-pointer',
|
'mr-6 py-3 border-b-2 border-transparent text-[13px] font-semibold leading-[18px] text-gray-400 cursor-pointer',
|
||||||
currentTab === 'TRACING' && '!border-[rgb(21,94,239)] text-gray-700',
|
currentTab === 'TRACING' && '!border-[rgb(21,94,239)] text-gray-700',
|
||||||
)}
|
)}
|
||||||
onClick={() => setCurrentTab('TRACING')}
|
onClick={() => setCurrentTab('TRACING')}
|
||||||
>{t('appLog.runDetail.tracing')}</div>
|
>{t('runLog.tracing')}</div>
|
||||||
</div>
|
</div>
|
||||||
{/* panel detal */}
|
{/* panel detal */}
|
||||||
<div className={cn('grow bg-white overflow-y-auto', currentTab === 'TRACING' && '!bg-gray-50')}>
|
<div className={cn('grow bg-white overflow-y-auto', currentTab === 'TRACING' && '!bg-gray-50')}>
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import type { FC } from 'react'
|
|||||||
// import React, { useState } from 'react'
|
// import React, { useState } from 'react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
// import cn from 'classnames'
|
// import cn from 'classnames'
|
||||||
|
import StatusPanel from './status'
|
||||||
// import Loading from '@/app/components/base/loading'
|
// import Loading from '@/app/components/base/loading'
|
||||||
// import Indicator from '@/app/components/header/indicator'
|
// import Indicator from '@/app/components/header/indicator'
|
||||||
|
|
||||||
@ -15,8 +16,27 @@ const Result: FC<ResultProps> = ({ appId }) => {
|
|||||||
// const [currentTab, setCurrentTab] = useState<string>(activeTab)
|
// const [currentTab, setCurrentTab] = useState<string>(activeTab)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='bg-white'>
|
<div className='bg-white py-2'>
|
||||||
Result panel = TODO
|
<div className='px-4 py-2'>
|
||||||
|
<StatusPanel status='running' time={0.653} tokens={27} />
|
||||||
|
</div>
|
||||||
|
<div className='px-4 py-2'>
|
||||||
|
<StatusPanel status='succeeded' time={0.653} tokens={27} />
|
||||||
|
</div>
|
||||||
|
<div className='px-4 py-2'>
|
||||||
|
<StatusPanel status='failed' time={0.653} tokens={27} />
|
||||||
|
</div>
|
||||||
|
<div className='px-4 py-2'>
|
||||||
|
<StatusPanel status='stopped' time={0.653} tokens={27} />
|
||||||
|
</div>
|
||||||
|
<div className='px-4 py-2 flex flex-col gap-2'>
|
||||||
|
<div>INPUT TODO</div>
|
||||||
|
<div>OUPUT TODO</div>
|
||||||
|
</div>
|
||||||
|
<div className='px-4 py-2'>
|
||||||
|
<div className='h-[0.5px] bg-[rbga(0,0,0,0.05)]'/>
|
||||||
|
</div>
|
||||||
|
<div className='px-4 py-2'>META DATA TODO</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
90
web/app/components/workflow/run/status.tsx
Normal file
90
web/app/components/workflow/run/status.tsx
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
'use client'
|
||||||
|
import type { FC } from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import cn from 'classnames'
|
||||||
|
import Indicator from '@/app/components/header/indicator'
|
||||||
|
|
||||||
|
type ResultProps = {
|
||||||
|
status: 'running' | 'succeeded' | 'failed' | 'stopped'
|
||||||
|
time?: number
|
||||||
|
tokens?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
const StatusPanel: FC<ResultProps> = ({
|
||||||
|
status,
|
||||||
|
time,
|
||||||
|
tokens,
|
||||||
|
}) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
'flex px-3 py-[10px] rounded-lg border-[0.5px] border-[rbga(0,0,0,0.05)] shadow-xs',
|
||||||
|
status === 'running' && '!bg-primary-50',
|
||||||
|
status === 'succeeded' && '!bg-[#ecfdf3]',
|
||||||
|
status === 'failed' && '!bg-[#fef3f2]',
|
||||||
|
status === 'stopped' && '!bg-gray-200',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<div className='mr-24'>
|
||||||
|
<div className='text-xs leading-[18px] font-medium text-gray-400'>{t('runLog.resultPanel.status')}</div>
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
'flex items-center gap-1 h-[18px] text-xs leading-3 font-semibold',
|
||||||
|
status === 'running' && '!text-primary-600',
|
||||||
|
status === 'succeeded' && '!text-[#039855]',
|
||||||
|
status === 'failed' && '!text-[#d92d20]',
|
||||||
|
status === 'stopped' && '!text-gray-700',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{status === 'running' && (
|
||||||
|
<span>Running</span>
|
||||||
|
)}
|
||||||
|
{status === 'succeeded' && (
|
||||||
|
<>
|
||||||
|
<Indicator color={'green'} />
|
||||||
|
<span>SUCCESS</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{status === 'failed' && (
|
||||||
|
<>
|
||||||
|
<Indicator color={'red'} />
|
||||||
|
<span>FAIL</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{status === 'stopped' && (
|
||||||
|
<>
|
||||||
|
<Indicator color={'gray'} />
|
||||||
|
<span>STOP</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className='mr-24'>
|
||||||
|
<div className='text-xs leading-[18px] font-medium text-gray-400'>{t('runLog.resultPanel.time')}</div>
|
||||||
|
<div className='flex items-center gap-1 h-[18px] text-gray-700 text-xs leading-3 font-semibold'>
|
||||||
|
{status === 'running' && (
|
||||||
|
<div className='w-16 h-2 rounded-sm bg-[rgba(0,0,0,0.05)]'/>
|
||||||
|
)}
|
||||||
|
{status !== 'running' && (
|
||||||
|
<span>{`${time}s`}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className='mr-24'>
|
||||||
|
<div className='text-xs leading-[18px] font-medium text-gray-400'>{t('runLog.resultPanel.tokens')}</div>
|
||||||
|
<div className='flex items-center gap-1 h-[18px] text-gray-700 text-xs leading-3 font-semibold'>
|
||||||
|
{status === 'running' && (
|
||||||
|
<div className='w-20 h-2 rounded-sm bg-[rgba(0,0,0,0.05)]'/>
|
||||||
|
)}
|
||||||
|
{status !== 'running' && (
|
||||||
|
<span>{`${tokens} Tokens`}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default StatusPanel
|
||||||
@ -75,8 +75,6 @@ const translation = {
|
|||||||
runDetail: {
|
runDetail: {
|
||||||
title: 'Conversation Log',
|
title: 'Conversation Log',
|
||||||
workflowTitle: 'Log Detail',
|
workflowTitle: 'Log Detail',
|
||||||
result: 'RESULT',
|
|
||||||
tracing: 'TRACING',
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
web/i18n/en-US/run-log.ts
Normal file
11
web/i18n/en-US/run-log.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const translation = {
|
||||||
|
result: 'RESULT',
|
||||||
|
tracing: 'TRACING',
|
||||||
|
resultPanel: {
|
||||||
|
status: 'STATUS',
|
||||||
|
time: 'ELAPSED TIME',
|
||||||
|
tokens: 'TOTAL TOKENS',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default translation
|
||||||
@ -27,6 +27,7 @@ const loadLangResources = (lang: string) => ({
|
|||||||
custom: require(`./${lang}/custom`).default,
|
custom: require(`./${lang}/custom`).default,
|
||||||
tools: require(`./${lang}/tools`).default,
|
tools: require(`./${lang}/tools`).default,
|
||||||
workflow: require(`./${lang}/workflow`).default,
|
workflow: require(`./${lang}/workflow`).default,
|
||||||
|
runLog: require(`./${lang}/run-log`).default,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
11
web/i18n/pt-BR/run-log.ts
Normal file
11
web/i18n/pt-BR/run-log.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const translation = {
|
||||||
|
result: 'RESULT',
|
||||||
|
tracing: 'TRACING',
|
||||||
|
resultPanel: {
|
||||||
|
status: 'STATUS',
|
||||||
|
time: 'ELAPSED TIME',
|
||||||
|
tokens: 'TOTAL TOKENS',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default translation
|
||||||
11
web/i18n/uk-UA/run-log.ts
Normal file
11
web/i18n/uk-UA/run-log.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const translation = {
|
||||||
|
result: 'RESULT',
|
||||||
|
tracing: 'TRACING',
|
||||||
|
resultPanel: {
|
||||||
|
status: 'STATUS',
|
||||||
|
time: 'ELAPSED TIME',
|
||||||
|
tokens: 'TOTAL TOKENS',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default translation
|
||||||
@ -72,10 +72,6 @@ const translation = {
|
|||||||
},
|
},
|
||||||
workflowTitle: '日志',
|
workflowTitle: '日志',
|
||||||
workflowSubtitle: '日志记录了应用的执行情况',
|
workflowSubtitle: '日志记录了应用的执行情况',
|
||||||
runDetail: {
|
|
||||||
title: '对话日志',
|
|
||||||
workflowTitle: '日志详情',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default translation
|
export default translation
|
||||||
|
|||||||
11
web/i18n/zh-Hans/run-log.ts
Normal file
11
web/i18n/zh-Hans/run-log.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const translation = {
|
||||||
|
result: '结果',
|
||||||
|
tracing: '追踪',
|
||||||
|
resultPanel: {
|
||||||
|
status: '状态',
|
||||||
|
time: '运行时间',
|
||||||
|
tokens: '总 token 数',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default translation
|
||||||
Loading…
Reference in New Issue
Block a user