hide result info in chatflow

This commit is contained in:
JzoNg 2024-04-02 17:16:07 +08:00
parent 74538fb3b2
commit d72524ceb0
3 changed files with 13 additions and 10 deletions

View File

@ -96,7 +96,7 @@ const getFormattedChatList = (messages: ChatMessage[]) => {
message_files: item.message_files?.filter((file: any) => file.belongs_to === 'assistant') || [],
log: [
...item.message,
...(item.message[item.message.length - 1].role !== 'assistant'
...(item.message[item.message.length - 1]?.role !== 'assistant'
? [
{
role: 'assistant',

View File

@ -57,7 +57,7 @@ const MessageLogModal: FC<MessageLogModalProps> = ({
<span className='absolute right-3 top-4 p-1 cursor-pointer z-20' onClick={onCancel}>
<XClose className='w-4 h-4 text-gray-500' />
</span>
<Run runID={currentLogItem.workflow_run_id}/>
<Run hideResult activeTab='DETAIL' runID={currentLogItem.workflow_run_id}/>
</div>
)
}

View File

@ -15,12 +15,13 @@ import type { WorkflowRunDetailResponse } from '@/models/log'
import { useStore as useAppStore } from '@/app/components/app/store'
export type RunProps = {
hideResult?: boolean
activeTab?: 'RESULT' | 'DETAIL' | 'TRACING'
runID: string
getResultCallback?: (result: WorkflowRunDetailResponse) => void
}
const RunPanel: FC<RunProps> = ({ activeTab = 'RESULT', runID, getResultCallback }) => {
const RunPanel: FC<RunProps> = ({ hideResult, activeTab = 'RESULT', runID, getResultCallback }) => {
const { t } = useTranslation()
const { notify } = useContext(ToastContext)
const [currentTab, setCurrentTab] = useState<string>(activeTab)
@ -94,13 +95,15 @@ const RunPanel: FC<RunProps> = ({ activeTab = 'RESULT', runID, getResultCallback
<div className='grow relative flex flex-col'>
{/* tab */}
<div className='shrink-0 flex items-center px-4 border-b-[0.5px] border-[rgba(0,0,0,0.05)]'>
<div
className={cn(
'mr-6 py-3 border-b-2 border-transparent text-[13px] font-semibold leading-[18px] text-gray-400 cursor-pointer',
currentTab === 'RESULT' && '!border-[rgb(21,94,239)] text-gray-700',
)}
onClick={() => switchTab('RESULT')}
>{t('runLog.result')}</div>
{!hideResult && (
<div
className={cn(
'mr-6 py-3 border-b-2 border-transparent text-[13px] font-semibold leading-[18px] text-gray-400 cursor-pointer',
currentTab === 'RESULT' && '!border-[rgb(21,94,239)] text-gray-700',
)}
onClick={() => switchTab('RESULT')}
>{t('runLog.result')}</div>
)}
<div
className={cn(
'mr-6 py-3 border-b-2 border-transparent text-[13px] font-semibold leading-[18px] text-gray-400 cursor-pointer',