From 58922ba40bc28e2dbf68bdb2c0caf8d40b56eaeb Mon Sep 17 00:00:00 2001 From: JzoNg Date: Thu, 14 Mar 2024 17:03:02 +0800 Subject: [PATCH] add route for workflow app --- web/app/(shareLayout)/workflow/[token]/page.tsx | 13 +++++++++++++ web/app/components/app/log/index.tsx | 6 +++--- web/app/components/app/overview/appCard.tsx | 2 +- web/app/components/app/workflow-log/index.tsx | 6 +++--- web/app/components/share/text-generation/index.tsx | 3 +++ 5 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 web/app/(shareLayout)/workflow/[token]/page.tsx diff --git a/web/app/(shareLayout)/workflow/[token]/page.tsx b/web/app/(shareLayout)/workflow/[token]/page.tsx new file mode 100644 index 0000000000..c1d7fa13a5 --- /dev/null +++ b/web/app/(shareLayout)/workflow/[token]/page.tsx @@ -0,0 +1,13 @@ +import type { FC } from 'react' +import React from 'react' + +import type { IMainProps } from '@/app/components/share/text-generation' +import Main from '@/app/components/share/text-generation' + +const TextGeneration: FC = () => { + return ( +
+ ) +} + +export default React.memo(TextGeneration) diff --git a/web/app/components/app/log/index.tsx b/web/app/components/app/log/index.tsx index f4572c563d..828004d6f3 100644 --- a/web/app/components/app/log/index.tsx +++ b/web/app/components/app/log/index.tsx @@ -68,9 +68,9 @@ const Logs: FC = ({ appDetail }) => { } const getWebAppType = (appType: AppMode) => { - if (appType === 'completion' || appType === 'workflow') - return 'completion' - return 'chat' + if (appType !== 'completion' && appType !== 'workflow') + return 'chat' + return appType } // Get the app type first diff --git a/web/app/components/app/overview/appCard.tsx b/web/app/components/app/overview/appCard.tsx index a3f6592f0d..2243f251e4 100644 --- a/web/app/components/app/overview/appCard.tsx +++ b/web/app/components/app/overview/appCard.tsx @@ -83,7 +83,7 @@ function AppCard({ : t('appOverview.overview.apiInfo.title') const runningStatus = isApp ? appInfo.enable_site : appInfo.enable_api const { app_base_url, access_token } = appInfo.site ?? {} - const appMode = (appInfo.mode === 'completion' || appInfo.mode === 'workflow') ? 'completion' : 'chat' + const appMode = (appInfo.mode !== 'completion' && appInfo.mode !== 'workflow') ? 'chat' : appInfo.mode const appUrl = `${app_base_url}/${appMode}/${access_token}` const apiUrl = appInfo?.api_base_url diff --git a/web/app/components/app/workflow-log/index.tsx b/web/app/components/app/workflow-log/index.tsx index c7c32d6b83..303c2069b2 100644 --- a/web/app/components/app/workflow-log/index.tsx +++ b/web/app/components/app/workflow-log/index.tsx @@ -60,9 +60,9 @@ const Logs: FC = ({ appDetail }) => { } const getWebAppType = (appType: AppMode) => { - if (appType === 'completion' || appType === 'workflow') - return 'completion' - return 'chat' + if (appType !== 'completion' && appType !== 'workflow') + return 'chat' + return appType } const { data: workflowLogs, mutate } = useSWR({ diff --git a/web/app/components/share/text-generation/index.tsx b/web/app/components/share/text-generation/index.tsx index edf276ffad..2940a38741 100644 --- a/web/app/components/share/text-generation/index.tsx +++ b/web/app/components/share/text-generation/index.tsx @@ -55,11 +55,13 @@ type Task = { export type IMainProps = { isInstalledApp?: boolean installedAppInfo?: InstalledApp + isWorkflow?: boolean } const TextGeneration: FC = ({ isInstalledApp = false, installedAppInfo, + isWorkflow = false, }) => { const { notify } = Toast @@ -346,6 +348,7 @@ const TextGeneration: FC = ({ useEffect(() => { (async () => { + console.log('isWorkflow', isWorkflow) const [appData, appParams]: any = await fetchInitData() const { app_id: appId, site: siteInfo, can_replace_logo } = appData setAppId(appId)