diff --git a/web/app/components/app/create-app-dialog/app-list/index.tsx b/web/app/components/app/create-app-dialog/app-list/index.tsx index 69990f9311..091e32ed54 100644 --- a/web/app/components/app/create-app-dialog/app-list/index.tsx +++ b/web/app/components/app/create-app-dialog/app-list/index.tsx @@ -151,7 +151,7 @@ const Apps = ({ if (app.app_id) await handleCheckPluginDependencies(app.app_id) localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') - getRedirection(isCurrentWorkspaceEditor, { id: app.app_id, mode }, push) + getRedirection(isCurrentWorkspaceEditor, { id: app.app_id!, mode }, push) } catch (e) { Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) diff --git a/web/app/components/app/create-from-dsl-modal/index.tsx b/web/app/components/app/create-from-dsl-modal/index.tsx index 26e175eb56..c975cd697b 100644 --- a/web/app/components/app/create-from-dsl-modal/index.tsx +++ b/web/app/components/app/create-from-dsl-modal/index.tsx @@ -102,8 +102,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS if (!response) return - - const { id, status, app_id, imported_dsl_version, current_dsl_version } = response + const { id, status, app_id, app_mode, imported_dsl_version, current_dsl_version } = response if (status === DSLImportStatus.COMPLETED || status === DSLImportStatus.COMPLETED_WITH_WARNINGS) { if (onSuccess) onSuccess() @@ -118,7 +117,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') if (app_id) await handleCheckPluginDependencies(app_id) - getRedirection(isCurrentWorkspaceEditor, { id: app_id }, push) + getRedirection(isCurrentWorkspaceEditor, { id: app_id!, mode: app_mode }, push) } else if (status === DSLImportStatus.PENDING) { setVersions({ @@ -151,7 +150,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS import_id: importId, }) - const { status, app_id } = response + const { status, app_id, app_mode } = response if (status === DSLImportStatus.COMPLETED) { if (onSuccess) @@ -166,7 +165,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS if (app_id) await handleCheckPluginDependencies(app_id) localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') - getRedirection(isCurrentWorkspaceEditor, { id: app_id }, push) + getRedirection(isCurrentWorkspaceEditor, { id: app_id!, mode: app_mode }, push) } else if (status === DSLImportStatus.FAILED) { notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) diff --git a/web/app/components/explore/app-list/index.tsx b/web/app/components/explore/app-list/index.tsx index df15348dd3..a1a2bafd71 100644 --- a/web/app/components/explore/app-list/index.tsx +++ b/web/app/components/explore/app-list/index.tsx @@ -146,7 +146,7 @@ const Apps = ({ if (app.app_id) await handleCheckPluginDependencies(app.app_id) localStorage.setItem(NEED_REFRESH_APP_LIST_KEY, '1') - getRedirection(isCurrentWorkspaceEditor, { id: app.app_id, mode }, push) + getRedirection(isCurrentWorkspaceEditor, { id: app.app_id!, mode }, push) } catch (e) { Toast.notify({ type: 'error', message: t('app.newApp.appCreateFailed') }) diff --git a/web/models/app.ts b/web/models/app.ts index b6094b85e9..737df6bfae 100644 --- a/web/models/app.ts +++ b/web/models/app.ts @@ -1,5 +1,5 @@ import type { LangFuseConfig, LangSmithConfig, OpikConfig, TracingProvider } from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/type' -import type { App, AppSSO, AppTemplate, SiteConfig } from '@/types/app' +import type { App, AppMode, AppSSO, AppTemplate, SiteConfig } from '@/types/app' import type { Dependency } from '@/app/components/plugins/types' /* export type App = { @@ -84,6 +84,7 @@ export type AppDetailResponse = App export type DSLImportResponse = { id: string status: DSLImportStatus + app_mode: AppMode app_id?: string current_dsl_version?: string imported_dsl_version?: string diff --git a/web/utils/app-redirection.ts b/web/utils/app-redirection.ts index 534b019250..93273129dc 100644 --- a/web/utils/app-redirection.ts +++ b/web/utils/app-redirection.ts @@ -1,6 +1,8 @@ +import type { AppMode } from '@/types/app' + export const getRedirection = ( isCurrentWorkspaceEditor: boolean, - app: any, + app: { id: string, mode: AppMode }, redirectionFunc: (href: string) => void, ) => { if (!isCurrentWorkspaceEditor) {