diff --git a/web/app/(commonLayout)/apps/AppModeLabel.tsx b/web/app/(commonLayout)/apps/AppModeLabel.tsx deleted file mode 100644 index b164a5b01a..0000000000 --- a/web/app/(commonLayout)/apps/AppModeLabel.tsx +++ /dev/null @@ -1,48 +0,0 @@ -'use client' - -import { useTranslation } from 'react-i18next' -import { type AppMode } from '@/types/app' -import { AiText, CuteRobote } from '@/app/components/base/icons/src/vender/solid/communication' -import { BubbleText } from '@/app/components/base/icons/src/vender/solid/education' -import { Route } from '@/app/components/base/icons/src/vender/line/mapsAndTravel' - -export type AppModeLabelProps = { - mode: AppMode -} - -const AppModeLabel = ({ - mode, -}: AppModeLabelProps) => { - const { t } = useTranslation() - - return ( - <> - {mode === 'completion' && ( -
- - {t('app.types.completion')} -
- )} - {(mode === 'chat' || mode === 'advanced-chat') && ( -
- - {t('app.types.chatbot')} -
- )} - {mode === 'agent-chat' && ( -
- - {t('app.types.agent')} -
- )} - {mode === 'workflow' && ( -
- - {t('app.types.workflow')} -
- )} - - ) -} - -export default AppModeLabel diff --git a/web/app/components/workflow/run/meta.tsx b/web/app/components/workflow/run/meta.tsx index a886399344..a5288aac76 100644 --- a/web/app/components/workflow/run/meta.tsx +++ b/web/app/components/workflow/run/meta.tsx @@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next' import dayjs from 'dayjs' type Props = { - status: 'running' | 'succeeded' | 'failed' | 'stopped' + status: string executor?: string startTime?: number time?: number @@ -88,17 +88,19 @@ const MetaData: FC = ({ )} -
-
{t('runLog.meta.steps')}
-
- {status === 'running' && ( -
- )} - {status !== 'running' && ( - {steps} - )} + {steps > 0 && ( +
+
{t('runLog.meta.steps')}
+
+ {status === 'running' && ( +
+ )} + {status !== 'running' && ( + {steps} + )} +
-
+ )}
) diff --git a/web/app/components/workflow/run/result-panel.tsx b/web/app/components/workflow/run/result-panel.tsx new file mode 100644 index 0000000000..bc5191efbe --- /dev/null +++ b/web/app/components/workflow/run/result-panel.tsx @@ -0,0 +1,88 @@ +'use client' +import type { FC } from 'react' +import StatusPanel from './status' +import MetaData from './meta' +import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor' +import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' + +type ResultPanelProps = { + inputs?: string + process_data?: string + outputs?: string + status: string + error?: string + elapsed_time?: number + total_tokens?: number + created_at?: number + created_by: string + finished_at?: number + steps: number +} + +const ResultPanel: FC = ({ + inputs, + process_data, + outputs, + status, + error, + elapsed_time, + total_tokens, + created_at, + created_by, + steps, +}) => { + return ( +
+
+ +
+
+ INPUT
} + language={CodeLanguage.json} + value={inputs || ''} + onChange={() => {}} + /> + {process_data && ( + PROCESS DATA
} + language={CodeLanguage.json} + value={process_data} + onChange={() => {}} + /> + )} + {outputs && ( + OUTPUT
} + language={CodeLanguage.json} + value={outputs} + onChange={() => {}} + /> + )} + +
+
+
+
+ +
+
+ ) +} + +export default ResultPanel diff --git a/web/app/components/workflow/run/result.tsx b/web/app/components/workflow/run/result.tsx index afe7f32418..ab2dfd53fc 100644 --- a/web/app/components/workflow/run/result.tsx +++ b/web/app/components/workflow/run/result.tsx @@ -1,11 +1,8 @@ 'use client' import type { FC } from 'react' import React, { useEffect, useMemo, useState } from 'react' -import StatusPanel from './status' -import MetaData from './meta' +import ResultPanel from './result-panel' import Loading from '@/app/components/base/loading' -import CodeEditor from '@/app/components/workflow/nodes/_base/components/editor/code-editor' -import { CodeLanguage } from '@/app/components/workflow/nodes/code/types' import { fetchRunDetail } from '@/service/log' import type { WorkflowRunDetailResponse } from '@/models/log' import { useStore as useAppStore } from '@/app/components/app/store' @@ -21,9 +18,9 @@ const Result: FC = ({ runID }) => { const executor = useMemo(() => { if (runDetail?.created_by_role === 'account') - return runDetail.created_by_account?.name + return runDetail.created_by_account?.name || '' if (runDetail?.created_by_role === 'end_user') - return runDetail.created_by_end_user?.session_id + return runDetail.created_by_end_user?.session_id || '' return 'N/A' }, [runDetail]) @@ -50,47 +47,17 @@ const Result: FC = ({ runID }) => { } return ( -
-
- -
-
- {/* ###TODO### value */} - INPUT
} - language={CodeLanguage.json} - value={''} - onChange={() => {}} - /> - {/* ###TODO### value */} - OUTPUT
} - language={CodeLanguage.json} - value={''} - onChange={() => {}} - /> - -
-
-
-
- -
-
+ ) } diff --git a/web/app/components/workflow/run/status.tsx b/web/app/components/workflow/run/status.tsx index b5422d812c..c2b8549c1d 100644 --- a/web/app/components/workflow/run/status.tsx +++ b/web/app/components/workflow/run/status.tsx @@ -5,7 +5,7 @@ import cn from 'classnames' import Indicator from '@/app/components/header/indicator' type ResultProps = { - status: 'running' | 'succeeded' | 'failed' | 'stopped' + status: string time?: number tokens?: number error?: string diff --git a/web/models/log.ts b/web/models/log.ts index f7a74503b4..e485a9d3b2 100644 --- a/web/models/log.ts +++ b/web/models/log.ts @@ -1,5 +1,9 @@ +import type { Viewport } from 'reactflow' import type { VisionFile } from '@/types/app' - +import type { + Edge, + Node, +} from '@/app/components/workflow/types' // Log type contains key:string conversation_id:string created_at:string quesiton:string answer:string export type Conversation = { id: string @@ -269,10 +273,14 @@ export type WorkflowRunDetailResponse = { id: string sequence_number: number version: string - graph: any // TODO - inputs: any // json + graph: { + nodes: Node[] + edges: Edge[] + viewport?: Viewport + } + inputs: string status: 'running' | 'succeeded' | 'failed' | 'stopped' - outputs?: any // json + outputs?: string error?: string elapsed_time?: number total_tokens?: number