add route for workflow app

This commit is contained in:
JzoNg 2024-03-14 17:03:02 +08:00
parent ac675c4443
commit 58922ba40b
5 changed files with 23 additions and 7 deletions

View File

@ -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<IMainProps> = () => {
return (
<Main isWorkflow />
)
}
export default React.memo(TextGeneration)

View File

@ -68,9 +68,9 @@ const Logs: FC<ILogsProps> = ({ 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

View File

@ -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

View File

@ -60,9 +60,9 @@ const Logs: FC<ILogsProps> = ({ 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({

View File

@ -55,11 +55,13 @@ type Task = {
export type IMainProps = {
isInstalledApp?: boolean
installedAppInfo?: InstalledApp
isWorkflow?: boolean
}
const TextGeneration: FC<IMainProps> = ({
isInstalledApp = false,
installedAppInfo,
isWorkflow = false,
}) => {
const { notify } = Toast
@ -346,6 +348,7 @@ const TextGeneration: FC<IMainProps> = ({
useEffect(() => {
(async () => {
console.log('isWorkflow', isWorkflow)
const [appData, appParams]: any = await fetchInitData()
const { app_id: appId, site: siteInfo, can_replace_logo } = appData
setAppId(appId)