Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(explore): improve template preview states and accessibility (#42830)

yyh5f66253fab0a
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index db14e213cf9..27cc56c59c0 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -4694,7 +4694,7 @@
},
"web/service/use-try-app.ts": {
"@tanstack/query/prefer-query-options": {
- "count": 4
+ "count": 3
}
},
"web/service/use-workflow.ts": {
diff --git a/web/app/components/apps/index.tsx b/web/app/components/apps/index.tsx
index fa6bc95fcab..1e735ad7f16 100644
--- a/web/app/components/apps/index.tsx
+++ b/web/app/components/apps/index.tsx
@@ -2,6 +2,7 @@
import type { RecommendedAppResponse } from '@dify/contracts/api/console/explore/types.gen'
import type { CreateAppModalProps } from '../explore/create-app-modal'
import type { TrackCreateAppParams } from '@/utils/create-app-tracking'
+import { noop, useQueryClient } from '@tanstack/react-query'
import { useAtomValue } from 'jotai'
import { useCallback, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@@ -13,7 +14,7 @@ import { useImportDSL } from '@/hooks/use-import-dsl'
import { DSLImportMode } from '@/models/app'
import dynamic from '@/next/dynamic'
import { useRouter, useSearchParams } from '@/next/navigation'
-import { consoleClient } from '@/service/console'
+import { consoleClient, consoleQuery } from '@/service/console'
import { trackCreateApp } from '@/utils/create-app-tracking'
import { hasPermission } from '@/utils/permission'
import { List } from './list'
@@ -30,6 +31,7 @@ const ImportFromMarketplaceTemplateModal = dynamic(
const AppListProvider = AppListContext.Provider
const AppsContent = () => {
+ const queryClient = useQueryClient()
const { t } = useTranslation(['app'])
const searchParams = useSearchParams()
const { replace } = useRouter()
@@ -48,10 +50,23 @@ const AppsContent = () => {
const hideTryAppPanel = useCallback(() => {
setIsShowTryAppPanel(false)
}, [])
- const openTryAppPanel = useCallback((app: RecommendedAppResponse) => {
- setCurrApp(app)
- setIsShowTryAppPanel(true)
- }, [])
+ const openTryAppPanel = useCallback(
+ (app: RecommendedAppResponse) => {
+ // Start the workflow request while the preview dialog's code and app details load.
+ if (app.app?.mode === 'workflow' || app.app?.mode === 'advanced-chat') {
+ void queryClient
+ .query(
+ consoleQuery.trialApps.byAppId.workflows.get.queryOptions({
+ input: { params: { app_id: app.app_id } },
+ }),
+ )
+ .catch(noop)
+ }
+ setCurrApp(app)
+ setIsShowTryAppPanel(true)
+ },
+ [queryClient],
+ )
const [isShowCreateModal, setIsShowCreateModal] = useState(false)
const handleCreateLearnDify = (app: RecommendedAppResponse) => {
@@ -179,7 +194,14 @@ const AppsContent = () => {
<div className="relative flex h-0 shrink-0 grow flex-col overflow-hidden bg-background-body">
<List onCreateLearnDify={handleCreateLearnDify} onTryLearnDify={openTryAppPanel} />
{isShowTryAppPanel && currApp && (
- <TryApp app={currApp} onClose={hideTryAppPanel} onCreate={handleShowFromTryApp} />
+ <TryApp
+ appId={currApp.app_id}
+ canTrial={currApp.can_trial}
+ categories={currApp.categories}
+ templateName={currApp.app?.name}
+ onClose={hideTryAppPanel}
+ onCreate={handleShowFromTryApp}
+ />
)}
{showDSLConfirmModal && (
diff --git a/web/app/components/explore/try-app/__tests__/index.spec.tsx b/web/app/components/explore/try-app/__tests__/index.spec.tsx
index dc36dcfc2b5..e683ff29973 100644
--- a/web/app/components/explore/try-app/__tests__/index.spec.tsx
+++ b/web/app/components/explore/try-app/__tests__/index.spec.tsx
@@ -1,7 +1,7 @@
import type { RecommendedAppResponse } from '@dify/contracts/api/console/explore/types.gen'
import type { ComponentProps } from 'react'
import type { TryAppInfo } from '@/service/try-app'
-import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vite-plus/test'
import TryAppComponent from '../index'
import { TypeEnum } from '../types'
@@ -11,13 +11,25 @@ const defaultApp: RecommendedAppResponse = { app_id: 'test-app-id', can_trial: t
function TryApp({
app = defaultApp,
...props
-}: Omit<ComponentProps<typeof TryAppComponent>, 'app'> & {
+}: Omit<
+ ComponentProps<typeof TryAppComponent>,
+ 'appId' | 'canTrial' | 'categories' | 'templateName'
+> & {
app?: RecommendedAppResponse
}) {
- return <TryAppComponent {...props} app={app} />
+ return (
+ <TryAppComponent
+ {...props}
+ appId={app.app_id}
+ canTrial={app.can_trial}
+ categories={app.categories}
+ templateName={app.app?.name}
+ />
+ )
}
const mockUseGetTryAppInfo = vi.fn()
+const mockPreviewSuspension = vi.hoisted(() => ({ promise: null as Promise<void> | null }))
vi.mock('@/service/use-try-app', () => ({
useGetTryAppInfo: (...args: unknown[]) => mockUseGetTryAppInfo(...args),
@@ -32,11 +44,14 @@ vi.mock('../app', () => ({
}))
vi.mock('../preview', () => ({
- default: ({ appId, appDetail }: { appId: string; appDetail: TryAppInfo }) => (
- <div data-testid="preview-component" data-app-id={appId} data-mode={appDetail?.mode}>
- Preview Component
- </div>
- ),
+ default: ({ appId, appDetail }: { appId: string; appDetail: TryAppInfo }) => {
+ if (mockPreviewSuspension.promise) throw mockPreviewSuspension.promise
+ return (
+ <div data-testid="preview-component" data-app-id={appId} data-mode={appDetail?.mode}>
+ Preview Component
+ </div>
+ )
+ },
}))
vi.mock('../app-info', () => ({
@@ -101,6 +116,7 @@ const createMockAppDetail = (mode: string = 'chat'): TryAppInfo =>
describe('TryApp (main index.tsx)', () => {
beforeEach(() => {
vi.clearAllMocks()
+ mockPreviewSuspension.promise = null
// Suppress expected React act() warnings from internal async state updates
vi.spyOn(console, 'error').mockImplementation(() => {})
mockUseGetTryAppInfo.mockReturnValue({
@@ -126,16 +142,73 @@ describe('TryApp (main index.tsx)', () => {
expect(screen.queryByRole('progressbar')).toBeInTheDocument()
})
- it('renders unavailable state when the app detail request fails', () => {
+ it('keeps the dialog and tabs mounted when the initial load finishes', () => {
+ let result = { data: null as TryAppInfo | null, isLoading: true }
+ mockUseGetTryAppInfo.mockImplementation(() => result)
+ const { rerender } = render(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
+ const dialog = screen.getByRole('dialog')
+ const detailTab = screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.detail' })
+ const tryTab = screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.try' })
+ expect(tryTab).toHaveAttribute('aria-disabled', 'true')
+
+ result = { data: createMockAppDetail(), isLoading: false }
+ rerender(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
+
+ expect(screen.getByRole('dialog')).toBe(dialog)
+ expect(screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.detail' })).toBe(detailTab)
+ expect(screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.try' })).toBe(tryTab)
+ expect(tryTab).not.toHaveAttribute('aria-disabled', 'true')
+ })
+
+ it('keeps the tabs mounted when the initial load fails', () => {
+ let result = { data: null, isLoading: true, isError: false, refetch: vi.fn() }
+ mockUseGetTryAppInfo.mockImplementation(() => result)
+ const { rerender } = render(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
+ const detailTab = screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.detail' })
+
+ result = { ...result, isLoading: false, isError: true }
+ rerender(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
+
+ expect(screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.detail' })).toBe(detailTab)
+ expect(screen.getByRole('button', { name: 'common.operation.retry' })).toBeInTheDocument()
+ })
+
+ it('keeps the dialog visible while preview content suspends', async () => {
+ let resolvePreview: () => void = () => {}
+ mockPreviewSuspension.promise = new Promise<void>((resolve) => {
+ resolvePreview = resolve
+ })
+ render(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
+
+ const dialog = screen.getByRole('dialog')
+ const detailTab = screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.detail' })
+ expect(screen.getByRole('progressbar')).toBeInTheDocument()
+ expect(screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.try' })).toBeInTheDocument()
+
+ await act(async () => {
+ mockPreviewSuspension.promise = null
+ resolvePreview()
+ })
+
+ expect(screen.getByRole('dialog')).toBe(dialog)
+ expect(screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.detail' })).toBe(detailTab)
+ expect(screen.getByTestId('preview-component')).toBeInTheDocument()
+ })
+
+ it('shows retry without the create panel when the app detail request fails', () => {
mockUseGetTryAppInfo.mockReturnValue({
data: null,
isError: true,
- error: new Error('App is unavailable'),
+ isFetching: false,
+ refetch: vi.fn(),
})
render(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
- expect(screen.getByText('App is unavailable')).toBeInTheDocument()
+ expect(screen.getByText('explore.tryApp.loadError')).toBeInTheDocument()
+ expect(screen.getByRole('button', { name: 'common.operation.retry' })).toBeEnabled()
+ expect(screen.queryByTestId('app-info-component')).not.toBeInTheDocument()
+ expect(screen.queryByTestId('create-button')).not.toBeInTheDocument()
})
it('renders unknown unavailable state when app detail is empty', () => {
@@ -143,33 +216,89 @@ describe('TryApp (main index.tsx)', () => {
data: null,
isLoading: false,
isError: false,
+ isFetching: false,
+ refetch: vi.fn(),
})
render(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
- expect(screen.getByText('share.common.appUnknownError')).toBeInTheDocument()
+ expect(screen.getByText('explore.tryApp.loadError')).toBeInTheDocument()
+ })
+
+ it('disables retry while fetching and restores the full preview after recovery', async () => {
+ const refetch = vi.fn().mockResolvedValue({ data: createMockAppDetail() })
+ let result = {
+ data: null as TryAppInfo | null,
+ isLoading: false,
+ isError: true,
+ isFetching: false,
+ refetch,
+ }
+ mockUseGetTryAppInfo.mockImplementation(() => result)
+ const { rerender } = render(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
+
+ const retryButton = screen.getByRole('button', { name: 'common.operation.retry' })
+ retryButton.focus()
+ fireEvent.click(retryButton)
+ expect(refetch).toHaveBeenCalledTimes(1)
+
+ result = { ...result, isFetching: true }
+ rerender(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
+ const retryingButton = screen.getByRole('button', { name: 'explore.tryApp.retrying' })
+ expect(retryingButton).toHaveAttribute('aria-disabled', 'true')
+ expect(retryingButton).toHaveFocus()
+ fireEvent.click(retryingButton)
+ expect(refetch).toHaveBeenCalledTimes(1)
+
+ result = { ...result, data: createMockAppDetail(), isError: false, isFetching: false }
+ rerender(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
+ expect(screen.getByTestId('preview-component')).toBeInTheDocument()
+ expect(screen.getByTestId('create-button')).toBeInTheDocument()
+ await waitFor(() => {
+ expect(screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.detail' })).toHaveFocus()
+ })
+ })
+
+ it('allows another retry after a failed request', () => {
+ const refetch = vi.fn().mockResolvedValue({ data: null })
+ mockUseGetTryAppInfo.mockReturnValue({
+ data: null,
+ isLoading: false,
+ isError: true,
+ isFetching: false,
+ refetch,
+ })
+ render(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
+
+ fireEvent.click(screen.getByRole('button', { name: 'common.operation.retry' }))
+ fireEvent.click(screen.getByRole('button', { name: 'common.operation.retry' }))
+ expect(refetch).toHaveBeenCalledTimes(2)
})
})
describe('content rendering', () => {
- it('uses app trial eligibility as the authoritative default tab', async () => {
+ it('defaults to details even when the app can be tried', async () => {
const app: RecommendedAppResponse = { app_id: 'test-app-id', can_trial: true }
render(<TryApp app={app} onClose={vi.fn()} onCreate={vi.fn()} />)
- expect(await screen.findByTestId('app-component')).toBeInTheDocument()
+ expect(await screen.findByTestId('preview-component')).toBeInTheDocument()
+ expect(screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.detail' })).toHaveAttribute(
+ 'aria-selected',
+ 'true',
+ )
})
- it('defaults to details and disables trial when the app is ineligible', async () => {
+ it('hides trial when the app is ineligible', async () => {
const app: RecommendedAppResponse = { app_id: 'test-app-id', can_trial: false }
render(<TryApp app={app} onClose={vi.fn()} onCreate={vi.fn()} />)
expect(await screen.findByTestId('preview-component')).toBeInTheDocument()
- expect(screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.try' })).toHaveAttribute(
- 'aria-disabled',
- 'true',
- )
+ expect(
+ screen.queryByRole('tab', { name: 'explore.tryApp.tabHeader.try' }),
+ ).not.toBeInTheDocument()
+ expect(screen.queryByTestId('app-component')).not.toBeInTheDocument()
})
it('renders Tab component', async () => {
@@ -181,15 +310,31 @@ describe('TryApp (main index.tsx)', () => {
})
})
- it('renders App component by default (TRY mode)', async () => {
+ it('renders Preview component by default (DETAIL mode)', async () => {
render(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
await waitFor(() => {
- expect(document.body.querySelector('[data-testid="app-component"]')).toBeInTheDocument()
- expect(
- document.body.querySelector('[data-testid="preview-component"]'),
- ).not.toBeInTheDocument()
+ expect(document.body.querySelector('[data-testid="preview-component"]')).toBeInTheDocument()
+ expect(document.body.querySelector('[data-testid="app-component"]')).not.toBeInTheDocument()
})
+ expect(screen.getByRole('dialog', { name: 'Test App Name' })).toBeInTheDocument()
+ })
+
+ it('names the dialog after the current template in all load states', () => {
+ const app: RecommendedAppResponse = {
+ ...defaultApp,
+ app: { id: 'test-app-id', name: 'Sample template', icon_url: null },
+ }
+ const { rerender } = render(<TryApp app={app} onClose={vi.fn()} onCreate={vi.fn()} />)
+ expect(screen.getByRole('dialog', { name: 'Sample template' })).toBeInTheDocument()
+
+ mockUseGetTryAppInfo.mockReturnValue({ data: null, isLoading: true })
+ rerender(<TryApp app={app} onClose={vi.fn()} onCreate={vi.fn()} />)
+ expect(screen.getByRole('dialog', { name: 'Sample template' })).toBeInTheDocument()
+
+ mockUseGetTryAppInfo.mockReturnValue({ data: null, isError: true, refetch: vi.fn() })
+ rerender(<TryApp app={app} onClose={vi.fn()} onCreate={vi.fn()} />)
+ expect(screen.getByRole('dialog', { name: 'Sample template' })).toBeInTheDocument()
})
it('renders AppInfo component', async () => {
@@ -212,39 +357,27 @@ describe('TryApp (main index.tsx)', () => {
})
describe('tab switching', () => {
- it('switches to Preview when Detail tab is clicked', async () => {
+ it('places Details before Try it in tab order', () => {
render(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
- await waitFor(() => {
- expect(screen.getByText('explore.tryApp.tabHeader.detail')).toBeInTheDocument()
- })
-
- fireEvent.click(screen.getByText('explore.tryApp.tabHeader.detail'))
-
- await waitFor(() => {
- expect(document.body.querySelector('[data-testid="preview-component"]')).toBeInTheDocument()
- expect(document.body.querySelector('[data-testid="app-component"]')).not.toBeInTheDocument()
- })
+ expect(screen.getAllByRole('tab').map((tab) => tab.textContent)).toEqual([
+ 'explore.tryApp.tabHeader.detail',
+ 'explore.tryApp.tabHeader.try',
+ ])
})
- it('switches back to App when Try tab is clicked', async () => {
+ it('switches to Try it and back to Details', async () => {
render(<TryApp onClose={vi.fn()} onCreate={vi.fn()} />)
- await waitFor(() => {
- expect(screen.getByText('explore.tryApp.tabHeader.detail')).toBeInTheDocument()
- })
-
- fireEvent.click(screen.getByText('explore.tryApp.tabHeader.detail'))
-
- await waitFor(() => {
- expect(document.body.querySelector('[data-testid="preview-component"]')).toBeInTheDocument()
- })
-
fireEvent.click(screen.getByText('explore.tryApp.tabHeader.try'))
await waitFor(() => {
expect(document.body.querySelector('[data-testid="app-component"]')).toBeInTheDocument()
})
+
+ fireEvent.click(screen.getByText('explore.tryApp.tabHeader.detail'))
+
+ expect(document.body.querySelector('[data-testid="preview-component"]')).toBeInTheDocument()
})
})
@@ -349,6 +482,8 @@ describe('TryApp (main index.tsx)', () => {
/>,
)
+ fireEvent.click(screen.getByRole('tab', { name: 'explore.tryApp.tabHeader.try' }))
+
await waitFor(() => {
const appComponent = document.body.querySelector('[data-testid="app-component"]')
expect(appComponent).toHaveAttribute('data-app-id', 'my-app-id')
diff --git a/web/app/components/explore/try-app/app-info/__tests__/use-get-requirements.spec.ts b/web/app/components/explore/try-app/app-info/__tests__/use-get-requirements.spec.ts
index 131f52210ff..037ef212710 100644
--- a/web/app/components/explore/try-app/app-info/__tests__/use-get-requirements.spec.ts
+++ b/web/app/components/explore/try-app/app-info/__tests__/use-get-requirements.spec.ts
@@ -3,10 +3,11 @@ import { renderHook } from '@testing-library/react'
import { afterEach, describe, expect, it, vi } from 'vite-plus/test'
import useGetRequirements from '../use-get-requirements'
-const mockUseGetTryAppFlowPreview = vi.fn()
+const mockUseQuery = vi.fn()
-vi.mock('@/service/use-try-app', () => ({
- useGetTryAppFlowPreview: (...args: unknown[]) => mockUseGetTryAppFlowPreview(...args),
+vi.mock('@tanstack/react-query', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@tanstack/react-query')>()),
+ useQuery: (...args: unknown[]) => mockUseQuery(...args),
}))
vi.mock('@/config', () => ({
@@ -52,7 +53,7 @@ describe('useGetRequirements', () => {
describe('basic app modes (chat, completion, agent-chat)', () => {
it('returns model provider for chat mode', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({ data: null })
+ mockUseQuery.mockReturnValue({ data: null })
const appDetail = createMockAppDetail('chat')
const { result } = renderHook(() => useGetRequirements({ appDetail, appId: 'test-app-id' }))
@@ -65,7 +66,7 @@ describe('useGetRequirements', () => {
})
it('returns model provider for completion mode', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({ data: null })
+ mockUseQuery.mockReturnValue({ data: null })
const appDetail = createMockAppDetail('completion', {
model_config: {
@@ -87,7 +88,7 @@ describe('useGetRequirements', () => {
})
it('returns model provider and tools for agent-chat mode', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({ data: null })
+ mockUseQuery.mockReturnValue({ data: null })
const appDetail = createMockAppDetail('agent-chat', {
model_config: {
@@ -130,7 +131,7 @@ describe('useGetRequirements', () => {
})
it('filters out disabled tools in agent mode', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({ data: null })
+ mockUseQuery.mockReturnValue({ data: null })
const appDetail = createMockAppDetail('agent-chat', {
model_config: {
@@ -167,7 +168,7 @@ describe('useGetRequirements', () => {
describe('advanced app modes (workflow, advanced-chat)', () => {
it('returns requirements from flow data for workflow mode', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({
+ mockUseQuery.mockReturnValue({
data: {
graph: {
nodes: [
@@ -201,7 +202,7 @@ describe('useGetRequirements', () => {
})
it('returns requirements from flow data for advanced-chat mode', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({
+ mockUseQuery.mockReturnValue({
data: {
graph: {
nodes: [
@@ -227,7 +228,7 @@ describe('useGetRequirements', () => {
})
it('returns empty requirements when flow data has no nodes', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({
+ mockUseQuery.mockReturnValue({
data: {
graph: {
nodes: [],
@@ -242,7 +243,7 @@ describe('useGetRequirements', () => {
})
it('returns empty requirements when flow data is null', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({
+ mockUseQuery.mockReturnValue({
data: null,
})
@@ -253,7 +254,7 @@ describe('useGetRequirements', () => {
})
it('extracts multiple LLM nodes from flow data', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({
+ mockUseQuery.mockReturnValue({
data: {
graph: {
nodes: [
@@ -289,7 +290,7 @@ describe('useGetRequirements', () => {
})
it('extracts multiple tool nodes from flow data', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({
+ mockUseQuery.mockReturnValue({
data: {
graph: {
nodes: [
@@ -323,7 +324,7 @@ describe('useGetRequirements', () => {
describe('deduplication', () => {
it('removes duplicate requirements by name', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({
+ mockUseQuery.mockReturnValue({
data: {
graph: {
nodes: [
@@ -360,7 +361,7 @@ describe('useGetRequirements', () => {
describe('icon URL generation', () => {
it('generates correct icon URL for model providers', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({ data: null })
+ mockUseQuery.mockReturnValue({ data: null })
const appDetail = createMockAppDetail('chat', {
model_config: {
@@ -383,7 +384,7 @@ describe('useGetRequirements', () => {
})
it('maps google model provider to gemini plugin icon URL', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({ data: null })
+ mockUseQuery.mockReturnValue({ data: null })
const appDetail = createMockAppDetail('chat', {
model_config: {
@@ -406,7 +407,7 @@ describe('useGetRequirements', () => {
})
it('maps special builtin tool providers to *_tool plugin icon URL', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({ data: null })
+ mockUseQuery.mockReturnValue({ data: null })
const appDetail = createMockAppDetail('agent-chat', {
model_config: {
@@ -441,22 +442,22 @@ describe('useGetRequirements', () => {
})
describe('hook calls', () => {
- it('calls useGetTryAppFlowPreview with correct parameters for basic apps', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({ data: null })
+ it('does not request workflow data for basic apps', () => {
+ mockUseQuery.mockReturnValue({ data: null })
const appDetail = createMockAppDetail('chat')
renderHook(() => useGetRequirements({ appDetail, appId: 'test-app-id' }))
- expect(mockUseGetTryAppFlowPreview).toHaveBeenCalledWith('test-app-id', true)
+ expect(mockUseQuery).toHaveBeenCalledWith(expect.objectContaining({ enabled: false }))
})
- it('calls useGetTryAppFlowPreview with correct parameters for advanced apps', () => {
- mockUseGetTryAppFlowPreview.mockReturnValue({ data: null })
+ it('requests workflow data for advanced apps', () => {
+ mockUseQuery.mockReturnValue({ data: null })
const appDetail = createMockAppDetail('workflow')
renderHook(() => useGetRequirements({ appDetail, appId: 'test-app-id' }))
- expect(mockUseGetTryAppFlowPreview).toHaveBeenCalledWith('test-app-id', false)
+ expect(mockUseQuery).toHaveBeenCalledWith(expect.objectContaining({ enabled: true }))
})
})
})
diff --git a/web/app/components/explore/try-app/app-info/use-get-requirements.ts b/web/app/components/explore/try-app/app-info/use-get-requirements.ts
index be62caf1154..c161f9147f3 100644
--- a/web/app/components/explore/try-app/app-info/use-get-requirements.ts
+++ b/web/app/components/explore/try-app/app-info/use-get-requirements.ts
@@ -1,9 +1,10 @@
import type { TryAppInfo } from '@/service/try-app'
import type { AgentTool } from '@/types/app'
+import { useQuery } from '@tanstack/react-query'
import { uniqBy } from 'es-toolkit/compat'
import { BlockEnum } from '@/app/components/workflow/types'
import { MARKETPLACE_API_PREFIX } from '@/config'
-import { useGetTryAppFlowPreview } from '@/service/use-try-app'
+import { consoleQuery } from '@/service/console'
type Params = {
appDetail: TryAppInfo
@@ -104,7 +105,12 @@ const useGetRequirements = ({ appDetail, appId }: Params) => {
const isBasic = ['chat', 'completion', 'agent-chat'].includes(appDetail.mode)
const isAgent = appDetail.mode === 'agent-chat'
const isAdvanced = !isBasic
- const { data: flowData } = useGetTryAppFlowPreview(appId, isBasic)
+ const { data: flowData } = useQuery(
+ consoleQuery.trialApps.byAppId.workflows.get.queryOptions({
+ input: { params: { app_id: appId } },
+ enabled: !isBasic,
+ }),
+ )
const requirements: RequirementItem[] = []
const modelConfig = appDetail.model_config
diff --git a/web/app/components/explore/try-app/index.tsx b/web/app/components/explore/try-app/index.tsx
index 1bb315a09e0..9c7d6ea615c 100644
--- a/web/app/components/explore/try-app/index.tsx
+++ b/web/app/components/explore/try-app/index.tsx
@@ -1,21 +1,25 @@
'use client'
import type { RecommendedAppResponse } from '@dify/contracts/api/console/explore/types.gen'
-import { Dialog, DialogContent } from '@langgenius/dify-ui/dialog'
+import { Button } from '@langgenius/dify-ui/button'
+import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'
import { IconButton } from '@langgenius/dify-ui/icon-button'
import { Tabs, TabsList, TabsPanel, TabsTab } from '@langgenius/dify-ui/tabs'
import * as React from 'react'
-import { useState } from 'react'
+import { Suspense, useId, useRef } from 'react'
import { useTranslation } from 'react-i18next'
-import AppUnavailable from '@/app/components/base/app-unavailable'
import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { useGetTryAppInfo } from '@/service/use-try-app'
-import App from './app'
import AppInfo from './app-info'
import Preview from './preview'
import { TypeEnum } from './types'
+const App = React.lazy(() => import('./app'))
+
type Props = Readonly<{
- app: RecommendedAppResponse
+ appId: RecommendedAppResponse['app_id']
+ canTrial: RecommendedAppResponse['can_trial']
+ categories?: RecommendedAppResponse['categories']
+ templateName?: NonNullable<RecommendedAppResponse['app']>['name']
canCreate?: boolean
createButtonStepByStepTourTarget?: string
onClose: () => void
@@ -23,18 +27,25 @@ type Props = Readonly<{
}>
function TryApp({
- app,
+ appId,
+ canTrial,
+ categories,
+ templateName,
canCreate = true,
createButtonStepByStepTourTarget,
onClose,
onCreate,
}: Props) {
const { t } = useTranslation(['common', 'explore'])
- const appId = app.app_id
- const canUseTryTab = app.can_trial
- const [type, setType] = useState<TypeEnum>(() => (canUseTryTab ? TypeEnum.TRY : TypeEnum.DETAIL))
- const activeType = canUseTryTab ? type : TypeEnum.DETAIL
- const { data: appDetail, isLoading, isError, error } = useGetTryAppInfo(appId)
+ const { data: appDetail, isLoading, isFetching, refetch } = useGetTryAppInfo(appId)
+ const hasLoadError = !isLoading && !appDetail
+ const retryLabelId = useId()
+ const detailTabRef = useRef<HTMLButtonElement>(null)
+
+ const handleRetry = async () => {
+ const { data } = await refetch()
+ if (data) detailTabRef.current?.focus()
+ }
return (
<Dialog
@@ -43,78 +54,121 @@ function TryApp({
if (!open) onClose()
}}
>
- <DialogContent className="h-[calc(100dvh-32px)] max-h-[calc(100dvh-32px)] w-full max-w-[calc(100vw-32px)] min-w-7xl overflow-hidden overflow-x-auto border-none p-2 text-left align-middle">
- {isLoading ? (
- <div className="flex h-full items-center justify-center">
- <LoadingPlaceholder />
- </div>
- ) : isError ? (
- <div className="flex h-full items-center justify-center">
- <AppUnavailable
- className="size-auto"
- isUnknownReason={!error}
- unknownReason={error instanceof Error ? error.message : undefined}
- />
- </div>
- ) : !appDetail ? (
- <div className="flex h-full items-center justify-center">
- <AppUnavailable className="size-auto" isUnknownReason />
- </div>
- ) : (
- <Tabs
- value={activeType}
- onValueChange={(selectedValue) => setType(selectedValue)}
- className="flex h-full flex-col"
- >
- <div className="flex shrink-0 justify-between pl-4">
- <TabsList>
+ <DialogContent
+ initialFocus={detailTabRef}
+ className="h-[calc(100dvh-16px)] max-h-[calc(100dvh-16px)] w-full max-w-[calc(100vw-16px)] min-w-7xl overflow-hidden overflow-x-auto border-none p-2 text-left align-middle"
+ >
+ <DialogTitle className="sr-only">
+ {templateName ?? appDetail?.name ?? t(($) => $['apps.title'], { ns: 'explore' })}
+ </DialogTitle>
+ <Tabs defaultValue={TypeEnum.DETAIL} className="flex h-full flex-col">
+ <div className="flex shrink-0 justify-between pl-4">
+ <TabsList>
+ <TabsTab
+ ref={detailTabRef}
+ value={TypeEnum.DETAIL}
+ className="pt-2 data-active:border-util-colors-blue-brand-blue-brand-500"
+ >
+ <span className="system-md-semibold-uppercase">
+ {t(($) => $['tryApp.tabHeader.detail'], { ns: 'explore' })}
+ </span>
+ </TabsTab>
+ {canTrial && (
<TabsTab
value={TypeEnum.TRY}
- disabled={!canUseTryTab}
+ disabled={!appDetail}
className="pt-2 data-active:border-util-colors-blue-brand-blue-brand-500"
>
<span className="system-md-semibold-uppercase">
{t(($) => $['tryApp.tabHeader.try'], { ns: 'explore' })}
</span>
</TabsTab>
- <TabsTab
- value={TypeEnum.DETAIL}
- className="pt-2 data-active:border-util-colors-blue-brand-blue-brand-500"
+ )}
+ </TabsList>
+ <IconButton
+ size="lg"
+ variant="tertiary"
+ aria-label={t(($) => $['operation.close'], { ns: 'common' })}
+ onClick={onClose}
+ >
+ <span aria-hidden className="i-ri-close-line size-5" />
+ </IconButton>
+ </div>
+ <div className="mt-2 flex h-0 grow justify-between space-x-2">
+ <TabsPanel value={TypeEnum.DETAIL} className="min-w-0 flex-1">
+ {isLoading ? (
+ <div className="flex h-full items-center justify-center">
+ <LoadingPlaceholder />
+ </div>
+ ) : hasLoadError ? (
+ <div className="flex h-full flex-col items-center justify-center gap-5">
+ <div className="flex flex-col items-center gap-5" role="alert">
+ <span className="flex size-12 items-center justify-center rounded-xl bg-background-body">
+ <span
+ aria-hidden
+ className="i-ri-error-warning-line size-6 text-text-tertiary"
+ />
+ </span>
+ <p className="title-xl-semi-bold text-text-primary">
+ {t(($) => $['tryApp.loadError'], { ns: 'explore' })}
+ </p>
+ </div>
+ <Button
+ variant="secondary-accent"
+ disabled={isFetching}
+ focusableWhenDisabled={isFetching}
+ aria-labelledby={retryLabelId}
+ onClick={handleRetry}
+ >
+ <span id={retryLabelId}>
+ {isFetching
+ ? t(($) => $['tryApp.retrying'], { ns: 'explore' })
+ : t(($) => $['operation.retry'], { ns: 'common' })}
+ </span>
+ </Button>
+ </div>
+ ) : appDetail ? (
+ <Suspense
+ fallback={
+ <div className="flex h-full items-center justify-center">
+ <LoadingPlaceholder />
+ </div>
+ }
>
- <span className="system-md-semibold-uppercase">
- {t(($) => $['tryApp.tabHeader.detail'], { ns: 'explore' })}
- </span>
- </TabsTab>
- </TabsList>
- <IconButton
- size="lg"
- variant="tertiary"
- aria-label={t(($) => $['operation.close'], { ns: 'common' })}
- onClick={onClose}
- >
- <span aria-hidden className="i-ri-close-line size-5" />
- </IconButton>
- </div>
- {/* Main content */}
- <div className="mt-2 flex h-0 grow justify-between space-x-2">
+ <Preview appId={appId} appDetail={appDetail} />
+ </Suspense>
+ ) : null}
+ </TabsPanel>
+ {canTrial && (
<TabsPanel value={TypeEnum.TRY} className="min-w-0 flex-1">
- <App appId={appId} appDetail={appDetail} />
- </TabsPanel>
- <TabsPanel value={TypeEnum.DETAIL} className="min-w-0 flex-1">
- <Preview appId={appId} appDetail={appDetail} />
+ {appDetail && (
+ <Suspense
+ fallback={
+ <div className="flex h-full items-center justify-center">
+ <LoadingPlaceholder />
+ </div>
+ }
+ >
+ <App appId={appId} appDetail={appDetail} />
+ </Suspense>
+ )}
</TabsPanel>
- <AppInfo
- className="w-90 shrink-0"
- appDetail={appDetail}
- appId={appId}
- canCreate={canCreate}
- categories={app.categories ?? []}
- createButtonStepByStepTourTarget={createButtonStepByStepTourTarget}
- onCreate={onCreate}
- />
- </div>
- </Tabs>
- )}
+ )}
+ {appDetail && (
+ <Suspense fallback={<div className="w-90 shrink-0" />}>
+ <AppInfo
+ className="w-90 shrink-0"
+ appDetail={appDetail}
+ appId={appId}
+ canCreate={canCreate}
+ categories={categories ?? []}
+ createButtonStepByStepTourTarget={createButtonStepByStepTourTarget}
+ onCreate={onCreate}
+ />
+ </Suspense>
+ )}
+ </div>
+ </Tabs>
</DialogContent>
</Dialog>
)
diff --git a/web/app/components/explore/try-app/preview/flow-app-preview.tsx b/web/app/components/explore/try-app/preview/flow-app-preview.tsx
index a5b253a9734..25e2d10b3f4 100644
--- a/web/app/components/explore/try-app/preview/flow-app-preview.tsx
+++ b/web/app/components/explore/try-app/preview/flow-app-preview.tsx
@@ -3,11 +3,12 @@ import type { JsonObject } from '@dify/contracts/api/console/trial-apps/types.ge
import type { FC } from 'react'
import type { Edge, Node } from '@/app/components/workflow/types'
import { cn } from '@langgenius/dify-ui/cn'
+import { useQuery } from '@tanstack/react-query'
import * as React from 'react'
import { LoadingPlaceholder } from '@/app/components/base/loading-placeholder'
import { BlockEnum } from '@/app/components/workflow/types'
import WorkflowPreview from '@/app/components/workflow/workflow-preview'
-import { useGetTryAppFlowPreview } from '@/service/use-try-app'
+import { consoleQuery } from '@/service/console'
type Props = {
readonly appId: string
@@ -153,7 +154,11 @@ const normalizeWorkflowPreviewGraph = (graph: JsonObject) => {
}
const FlowAppPreview: FC<Props> = ({ appId, className }) => {
- const { data, isLoading } = useGetTryAppFlowPreview(appId)
+ const { data, isLoading } = useQuery(
+ consoleQuery.trialApps.byAppId.workflows.get.queryOptions({
+ input: { params: { app_id: appId } },
+ }),
+ )
if (isLoading) {
return (
diff --git a/web/features/home/home-content/home-content.tsx b/web/features/home/home-content/home-content.tsx
index 94b60ed7db0..d93c847b505 100644
--- a/web/features/home/home-content/home-content.tsx
+++ b/web/features/home/home-content/home-content.tsx
@@ -5,7 +5,7 @@ import type { CreateAppModalProps } from '@/app/components/explore/create-app-mo
import type { StepByStepTourTaskId } from '@/app/components/step-by-step-tour/types'
import type { TrackCreateAppParams } from '@/utils/create-app-tracking'
import { cn } from '@langgenius/dify-ui/cn'
-import { useQueryClient, useSuspenseQueries, useSuspenseQuery } from '@tanstack/react-query'
+import { noop, useQueryClient, useSuspenseQueries, useSuspenseQuery } from '@tanstack/react-query'
import { useAtomValue, useSetAtom } from 'jotai'
import { useQueryState } from 'nuqs'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
@@ -250,14 +250,26 @@ export function HomeContent() {
hideTryAppPanel()
}
}, [currentTryApp, hideTryAppPanel, homeTryAppCreateGuideActive, isShowCreateModal])
- const handleTryApp = useCallback((app: RecommendedAppResponse) => {
- isCurrentTryAppFromLearnDifyRef.current = false
- setCurrentTryApp(app)
- }, [])
+ const handleTryApp = useCallback(
+ (app: RecommendedAppResponse, fromLearnDify = false) => {
+ // Start the workflow request while the preview dialog's code and app details load.
+ if (app.app?.mode === 'workflow' || app.app?.mode === 'advanced-chat') {
+ void queryClient
+ .query(
+ consoleQuery.trialApps.byAppId.workflows.get.queryOptions({
+ input: { params: { app_id: app.app_id } },
+ }),
+ )
+ .catch(noop)
+ }
+ isCurrentTryAppFromLearnDifyRef.current = fromLearnDify
+ setCurrentTryApp(app)
+ },
+ [queryClient],
+ )
const handleTryAppFromLearnDify = useCallback(
(app: RecommendedAppResponse) => {
- isCurrentTryAppFromLearnDifyRef.current = true
- setCurrentTryApp(app)
+ handleTryApp(app, true)
if (
activeStepByStepTourTaskId === HOME_STEP_BY_STEP_TOUR_TASK_ID &&
@@ -282,6 +294,7 @@ export function HomeContent() {
canCreateApp,
completedStepByStepTourTaskIds,
completeHomeTourAfterOpenDetails,
+ handleTryApp,
],
)
const handleShowFromTryApp = useCallback(() => {
@@ -486,7 +499,10 @@ export function HomeContent() {
{currentTryApp && (
<TryApp
- app={currentTryApp}
+ appId={currentTryApp.app_id}
+ canTrial={currentTryApp.can_trial}
+ categories={currentTryApp.categories}
+ templateName={currentTryApp.app?.name}
canCreate={canCreateApp}
createButtonStepByStepTourTarget={
canCreateApp && isCurrentTryAppFromLearnDifyRef.current && !isShowCreateModal
diff --git a/web/i18n/locales/ar-TN/explore.json b/web/i18n/locales/ar-TN/explore.json
index ad167fd6791..7537a1e665b 100644
--- a/web/i18n/locales/ar-TN/explore.json
+++ b/web/i18n/locales/ar-TN/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "تطبيقات الويب",
"tryApp.category": "الفئة",
"tryApp.createFromSampleApp": "إنشاء من هذا التطبيق النموذجي",
+ "tryApp.loadError": "تعذّر تحميل هذا القالب",
"tryApp.requirements": "المتطلبات",
+ "tryApp.retrying": "جارٍ إعادة المحاولة…",
"tryApp.tabHeader.detail": "تفاصيل التنسيق",
"tryApp.tabHeader.try": "جرب",
"tryApp.tryInfo": "هذا تطبيق نموذجي. يمكنك تجربة ما يصل إلى 5 رسائل. لمواصلة استخدامه، انقر فوق \"إنشاء من هذا التطبيق النموذجي\" وقم بإعداده!"
diff --git a/web/i18n/locales/az-AZ/explore.json b/web/i18n/locales/az-AZ/explore.json
index 33ce0a30332..c66f980ae57 100644
--- a/web/i18n/locales/az-AZ/explore.json
+++ b/web/i18n/locales/az-AZ/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Veb tətbiqləri",
"tryApp.category": "Kateqoriya",
"tryApp.createFromSampleApp": "Bu nümunə tətbiqdən yarat",
+ "tryApp.loadError": "Bu şablon yüklənə bilmədi",
"tryApp.requirements": "Tələblər",
+ "tryApp.retrying": "Yenidən cəhd edilir…",
"tryApp.tabHeader.detail": "İş axınının qurulması haqqında təfərrüatlar",
"tryApp.tabHeader.try": "Sına",
"tryApp.tryInfo": "Bu, nümunə tətbiqdir. Ən çox 5 mesajla sınaqdan keçirə bilərsiniz. İstifadəyə davam etmək üçün \"Bu nümunə tətbiqdən yarat\" düyməsinə klikləyin və tətbiqi qurun!"
diff --git a/web/i18n/locales/de-DE/explore.json b/web/i18n/locales/de-DE/explore.json
index a9a290e2bef..6a84603bac0 100644
--- a/web/i18n/locales/de-DE/explore.json
+++ b/web/i18n/locales/de-DE/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Web-Apps",
"tryApp.category": "Kategorie",
"tryApp.createFromSampleApp": "Aus dieser Beispiel-App erstellen",
+ "tryApp.loadError": "Diese Vorlage konnte nicht geladen werden",
"tryApp.requirements": "Anforderungen",
+ "tryApp.retrying": "Erneuter Versuch…",
"tryApp.tabHeader.detail": "Orchestrierungsdetails",
"tryApp.tabHeader.try": "Ausprobieren",
"tryApp.tryInfo": "Dies ist eine Beispiel-App. Sie können bis zu 5 Nachrichten ausprobieren. Um sie weiter zu nutzen, klicken Sie auf \"Aus dieser Beispiel-App erstellen\" und richten Sie sie ein!"
diff --git a/web/i18n/locales/en-US/explore.json b/web/i18n/locales/en-US/explore.json
index 6c183f56c1b..25ee5d9467b 100644
--- a/web/i18n/locales/en-US/explore.json
+++ b/web/i18n/locales/en-US/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Web apps",
"tryApp.category": "Category",
"tryApp.createFromSampleApp": "Create from this sample app",
+ "tryApp.loadError": "We couldn’t load this template",
"tryApp.requirements": "Requirements",
+ "tryApp.retrying": "Retrying…",
"tryApp.tabHeader.detail": "Orchestration Details",
"tryApp.tabHeader.try": "Try it",
"tryApp.tryInfo": "This is a sample app. You can try up to 5 messages. To keep using it, click \"Create from this sample app\" and set it up!"
diff --git a/web/i18n/locales/es-ES/explore.json b/web/i18n/locales/es-ES/explore.json
index 3936fa96ff0..70887a537f9 100644
--- a/web/i18n/locales/es-ES/explore.json
+++ b/web/i18n/locales/es-ES/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Aplicaciones web",
"tryApp.category": "Categoría",
"tryApp.createFromSampleApp": "Crear desde esta aplicación de ejemplo",
+ "tryApp.loadError": "No pudimos cargar esta plantilla",
"tryApp.requirements": "Requisitos",
+ "tryApp.retrying": "Reintentando…",
"tryApp.tabHeader.detail": "Detalles de Orquestación",
"tryApp.tabHeader.try": "Probar",
"tryApp.tryInfo": "Esta es una aplicación de ejemplo. Puedes probar hasta 5 mensajes. Para seguir usándola, haz clic en \"Crear desde esta aplicación de ejemplo\" y configúrala!"
diff --git a/web/i18n/locales/fa-IR/explore.json b/web/i18n/locales/fa-IR/explore.json
index 28f045edeae..c5e5468cf63 100644
--- a/web/i18n/locales/fa-IR/explore.json
+++ b/web/i18n/locales/fa-IR/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "برنامه‌های وب",
"tryApp.category": "دسته‌بندی",
"tryApp.createFromSampleApp": "از این برنامه نمونه ایجاد کنید",
+ "tryApp.loadError": "بارگیری این قالب ممکن نشد",
"tryApp.requirements": "الزامات",
+ "tryApp.retrying": "در حال تلاش دوباره…",
"tryApp.tabHeader.detail": "جزئیات ارکستراسیون",
"tryApp.tabHeader.try": "امتحان کنید",
"tryApp.tryInfo": "این یک برنامه نمونه است. می‌توانید تا 5 پیام را امتحان کنید. برای ادامه استفاده از آن، روی \"از این برنامه نمونه ایجاد کنید\" کلیک کنید و آن را تنظیم کنید!"
diff --git a/web/i18n/locales/fr-FR/explore.json b/web/i18n/locales/fr-FR/explore.json
index 5e4d843cf8a..09d6f97dccf 100644
--- a/web/i18n/locales/fr-FR/explore.json
+++ b/web/i18n/locales/fr-FR/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Applications web",
"tryApp.category": "Catégorie",
"tryApp.createFromSampleApp": "Créer à partir de cette application exemple",
+ "tryApp.loadError": "Nous n’avons pas pu charger ce modèle",
"tryApp.requirements": "Exigences",
+ "tryApp.retrying": "Nouvelle tentative…",
"tryApp.tabHeader.detail": "Détails d'orchestration",
"tryApp.tabHeader.try": "Essayer",
"tryApp.tryInfo": "Ceci est une application exemple. Vous pouvez essayer jusqu'à 5 messages. Pour continuer à l'utiliser, cliquez sur \"Créer à partir de cette application exemple\" et configurez-la !"
diff --git a/web/i18n/locales/hi-IN/explore.json b/web/i18n/locales/hi-IN/explore.json
index 033471e3989..e5c25d56655 100644
--- a/web/i18n/locales/hi-IN/explore.json
+++ b/web/i18n/locales/hi-IN/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "वेब ऐप्स",
"tryApp.category": "श्रेणी",
"tryApp.createFromSampleApp": "इस नमूना ऐप से बनाएं",
+ "tryApp.loadError": "हम यह टेम्पलेट लोड नहीं कर सके",
"tryApp.requirements": "आवश्यकताएँ",
+ "tryApp.retrying": "पुनः प्रयास किया जा रहा है…",
"tryApp.tabHeader.detail": "ऑर्केस्ट्रेशन विवरण",
"tryApp.tabHeader.try": "आज़माएं",
"tryApp.tryInfo": "यह एक नमूना ऐप है। आप 5 संदेशों तक प्रयास कर सकते हैं। इसे उपयोग जारी रखने के लिए, \"इस नमूना ऐप से बनाएं\" पर क्लिक करें और इसे सेट करें!"
diff --git a/web/i18n/locales/id-ID/explore.json b/web/i18n/locales/id-ID/explore.json
index 1c782d6d275..ec111ed260d 100644
--- a/web/i18n/locales/id-ID/explore.json
+++ b/web/i18n/locales/id-ID/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Aplikasi web",
"tryApp.category": "Kategori",
"tryApp.createFromSampleApp": "Buat dari aplikasi contoh ini",
+ "tryApp.loadError": "Kami tidak dapat memuat templat ini",
"tryApp.requirements": "Persyaratan",
+ "tryApp.retrying": "Mencoba lagi…",
"tryApp.tabHeader.detail": "Detail Orkestrasi",
"tryApp.tabHeader.try": "Coba",
"tryApp.tryInfo": "Ini adalah aplikasi contoh. Anda dapat mencoba hingga 5 pesan. Untuk terus menggunakannya, klik \"Buat dari aplikasi contoh ini\" dan atur!"
diff --git a/web/i18n/locales/it-IT/explore.json b/web/i18n/locales/it-IT/explore.json
index d7cd2dfd74f..c2c39867aa6 100644
--- a/web/i18n/locales/it-IT/explore.json
+++ b/web/i18n/locales/it-IT/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "App web",
"tryApp.category": "Categoria",
"tryApp.createFromSampleApp": "Crea da questa app di esempio",
+ "tryApp.loadError": "Impossibile caricare questo modello",
"tryApp.requirements": "Requisiti",
+ "tryApp.retrying": "Nuovo tentativo…",
"tryApp.tabHeader.detail": "Dettagli di orchestrazione",
"tryApp.tabHeader.try": "Prova",
"tryApp.tryInfo": "Questa è un'app di esempio. Puoi provare fino a 5 messaggi. Per continuare a utilizzarla, fai clic su \"Crea da questa app di esempio\" e configurala!"
diff --git a/web/i18n/locales/ja-JP/explore.json b/web/i18n/locales/ja-JP/explore.json
index 8406691242e..689f3d4ee05 100644
--- a/web/i18n/locales/ja-JP/explore.json
+++ b/web/i18n/locales/ja-JP/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Webアプリ",
"tryApp.category": "カテゴリー",
"tryApp.createFromSampleApp": "テンプレートから作成",
+ "tryApp.loadError": "このテンプレートを読み込めませんでした",
"tryApp.requirements": "必要項目",
+ "tryApp.retrying": "再試行中…",
"tryApp.tabHeader.detail": "オーケストレーション詳細",
"tryApp.tabHeader.try": "お試し",
"tryApp.tryInfo": "これはサンプルアプリです。最大5件のメッセージまでお試しいただけます。引き続き利用するには、「テンプレートから作成」 をクリックして設定を行ってください。"
diff --git a/web/i18n/locales/ko-KR/explore.json b/web/i18n/locales/ko-KR/explore.json
index 8cf1c6ab3e3..55262e98663 100644
--- a/web/i18n/locales/ko-KR/explore.json
+++ b/web/i18n/locales/ko-KR/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "웹 앱",
"tryApp.category": "카테고리",
"tryApp.createFromSampleApp": "이 샘플 앱에서 만들기",
+ "tryApp.loadError": "이 템플릿을 불러올 수 없습니다",
"tryApp.requirements": "요구 사항",
+ "tryApp.retrying": "다시 시도하는 중…",
"tryApp.tabHeader.detail": "오케스트레이션 세부 정보",
"tryApp.tabHeader.try": "사용해 보기",
"tryApp.tryInfo": "이것은 샘플 앱입니다. 최대 5개의 메시지를 시도할 수 있습니다. 계속 사용하려면 \"이 샘플 앱에서 만들기\"를 클릭하고 설정하세요!"
diff --git a/web/i18n/locales/lo-LA/explore.json b/web/i18n/locales/lo-LA/explore.json
index c43244b50c2..21a85481811 100644
--- a/web/i18n/locales/lo-LA/explore.json
+++ b/web/i18n/locales/lo-LA/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "ແອັບເວັບ",
"tryApp.category": "ໝວດໝູ່",
"tryApp.createFromSampleApp": "ສ້າງຈາກແອັບຕົວຢ່າງນີ້",
+ "tryApp.loadError": "ບໍ່ສາມາດໂຫຼດແມ່ແບບນີ້ໄດ້",
"tryApp.requirements": "ຂໍ້ກຳນົດ",
+ "tryApp.retrying": "ກຳລັງລອງໃໝ່…",
"tryApp.tabHeader.detail": "ລາຍລະອຽດການຈັດການ (Orchestration)",
"tryApp.tabHeader.try": "ທົດລອງໃຊ້",
"tryApp.tryInfo": "ນີ້ຄືແອັບຕົວຢ່າງ. ເຈົ້າສາມາດທົດລອງສົ່ງຂໍ້ຄວາມໄດ້ສູງສຸດ 5 ຂໍ້ຄວາມ. ເພື່ອໃຊ້ງານຕໍ່, ໃຫ້ຄລິກ \"ສ້າງຈາກແອັບຕົວຢ່າງນີ້\" ແລະ ຕັ້ງຄ່າໃຫ້ຮຽບຮ້ອຍ!"
diff --git a/web/i18n/locales/nl-NL/explore.json b/web/i18n/locales/nl-NL/explore.json
index a7edcf1d679..0db52eceb86 100644
--- a/web/i18n/locales/nl-NL/explore.json
+++ b/web/i18n/locales/nl-NL/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Web apps",
"tryApp.category": "Category",
"tryApp.createFromSampleApp": "Create from this sample app",
+ "tryApp.loadError": "We konden deze sjabloon niet laden",
"tryApp.requirements": "Requirements",
+ "tryApp.retrying": "Opnieuw proberen…",
"tryApp.tabHeader.detail": "Orchestration Details",
"tryApp.tabHeader.try": "Try it",
"tryApp.tryInfo": "This is a sample app. You can try up to 5 messages. To keep using it, click \"Create from this sample app\" and set it up!"
diff --git a/web/i18n/locales/pl-PL/explore.json b/web/i18n/locales/pl-PL/explore.json
index efe60284760..883ce373fe1 100644
--- a/web/i18n/locales/pl-PL/explore.json
+++ b/web/i18n/locales/pl-PL/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Aplikacje internetowe",
"tryApp.category": "Kategoria",
"tryApp.createFromSampleApp": "Utwórz z tej przykładowej aplikacji",
+ "tryApp.loadError": "Nie udało się wczytać tego szablonu",
"tryApp.requirements": "Wymagania",
+ "tryApp.retrying": "Ponawianie próby…",
"tryApp.tabHeader.detail": "Szczegóły orkiestracji",
"tryApp.tabHeader.try": "Wypróbuj",
"tryApp.tryInfo": "To jest przykładowa aplikacja. Możesz wypróbować do 5 wiadomości. Aby nadal z niej korzystać, kliknij \"Utwórz z tej przykładowej aplikacji\" i skonfiguruj ją!"
diff --git a/web/i18n/locales/pt-BR/explore.json b/web/i18n/locales/pt-BR/explore.json
index 741bbfcdcbe..cd3978961dd 100644
--- a/web/i18n/locales/pt-BR/explore.json
+++ b/web/i18n/locales/pt-BR/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Aplicativos web",
"tryApp.category": "Categoria",
"tryApp.createFromSampleApp": "Criar a partir deste aplicativo de exemplo",
+ "tryApp.loadError": "Não foi possível carregar este modelo",
"tryApp.requirements": "Requisitos",
+ "tryApp.retrying": "Tentando novamente…",
"tryApp.tabHeader.detail": "Detalhes de Orquestração",
"tryApp.tabHeader.try": "Experimentar",
"tryApp.tryInfo": "Este é um aplicativo de exemplo. Você pode experimentar até 5 mensagens. Para continuar usando, clique em \"Criar a partir deste aplicativo de exemplo\" e configure-o!"
diff --git a/web/i18n/locales/ro-RO/explore.json b/web/i18n/locales/ro-RO/explore.json
index 3dcba233f2d..988fda0acbc 100644
--- a/web/i18n/locales/ro-RO/explore.json
+++ b/web/i18n/locales/ro-RO/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Aplicații web",
"tryApp.category": "Categorie",
"tryApp.createFromSampleApp": "Creați din această aplicație exemplu",
+ "tryApp.loadError": "Nu am putut încărca acest șablon",
"tryApp.requirements": "Cerințe",
+ "tryApp.retrying": "Se încearcă din nou…",
"tryApp.tabHeader.detail": "Detalii orchestrare",
"tryApp.tabHeader.try": "Încercați",
"tryApp.tryInfo": "Aceasta este o aplicație exemplu. Puteți încerca până la 5 mesaje. Pentru a continua să o utilizați, faceți clic pe \"Creați din această aplicație exemplu\" și configurați-o!"
diff --git a/web/i18n/locales/ru-RU/explore.json b/web/i18n/locales/ru-RU/explore.json
index 1ffe3806de8..0e6191966e9 100644
--- a/web/i18n/locales/ru-RU/explore.json
+++ b/web/i18n/locales/ru-RU/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Веб-приложения",
"tryApp.category": "Категория",
"tryApp.createFromSampleApp": "Создать из этого примера приложения",
+ "tryApp.loadError": "Не удалось загрузить этот шаблон",
"tryApp.requirements": "Требования",
+ "tryApp.retrying": "Повторная попытка…",
"tryApp.tabHeader.detail": "Детали оркестрации",
"tryApp.tabHeader.try": "Попробовать",
"tryApp.tryInfo": "Это пример приложения. Вы можете попробовать до 5 сообщений. Чтобы продолжить его использование, нажмите \"Создать из этого примера приложения\" и настройте его!"
diff --git a/web/i18n/locales/sl-SI/explore.json b/web/i18n/locales/sl-SI/explore.json
index 6d659a513a8..6fabc265a67 100644
--- a/web/i18n/locales/sl-SI/explore.json
+++ b/web/i18n/locales/sl-SI/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Spletne aplikacije",
"tryApp.category": "Kategorija",
"tryApp.createFromSampleApp": "Ustvari iz te vzorčne aplikacije",
+ "tryApp.loadError": "Te predloge ni bilo mogoče naložiti",
"tryApp.requirements": "Zahteve",
+ "tryApp.retrying": "Ponovni poskus…",
"tryApp.tabHeader.detail": "Podrobnosti orkestracije",
"tryApp.tabHeader.try": "Preizkusi",
"tryApp.tryInfo": "To je vzorčna aplikacija. Lahko preizkusite do 5 sporočil. Za nadaljnjo uporabo kliknite \"Ustvari iz te vzorčne aplikacije\" in jo nastavite!"
diff --git a/web/i18n/locales/th-TH/explore.json b/web/i18n/locales/th-TH/explore.json
index 7ceab65d60d..f05826f4ca9 100644
--- a/web/i18n/locales/th-TH/explore.json
+++ b/web/i18n/locales/th-TH/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "แอปเว็บ",
"tryApp.category": "หมวดหมู่",
"tryApp.createFromSampleApp": "สร้างจากแอปตัวอย่างนี้",
+ "tryApp.loadError": "ไม่สามารถโหลดเทมเพลตนี้ได้",
"tryApp.requirements": "ข้อกำหนด",
+ "tryApp.retrying": "กำลังลองอีกครั้ง…",
"tryApp.tabHeader.detail": "รายละเอียดการออร์เคสตร้า",
"tryApp.tabHeader.try": "ลองใช้",
"tryApp.tryInfo": "นี่คือแอปตัวอย่าง คุณสามารถลองใช้ได้สูงสุด 5 ข้อความ หากต้องการใช้ต่อ ให้คลิก \"สร้างจากแอปตัวอย่างนี้\" และตั้งค่า!"
diff --git a/web/i18n/locales/tr-TR/explore.json b/web/i18n/locales/tr-TR/explore.json
index b4fc6a86120..1c70854282f 100644
--- a/web/i18n/locales/tr-TR/explore.json
+++ b/web/i18n/locales/tr-TR/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Web uygulamaları",
"tryApp.category": "Kategori",
"tryApp.createFromSampleApp": "Bu örnek uygulamadan oluştur",
+ "tryApp.loadError": "Bu şablon yüklenemedi",
"tryApp.requirements": "Gereksinimler",
+ "tryApp.retrying": "Yeniden deneniyor…",
"tryApp.tabHeader.detail": "Orkestrasyon Detayları",
"tryApp.tabHeader.try": "Deneyin",
"tryApp.tryInfo": "Bu bir örnek uygulamadır. 5 mesaja kadar deneyebilirsiniz. Kullanmaya devam etmek için \"Bu örnek uygulamadan oluştur\" seçeneğine tıklayın ve ayarlayın!"
diff --git a/web/i18n/locales/uk-UA/explore.json b/web/i18n/locales/uk-UA/explore.json
index 227fe71422c..93ef510367f 100644
--- a/web/i18n/locales/uk-UA/explore.json
+++ b/web/i18n/locales/uk-UA/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Веб-додатки",
"tryApp.category": "Категорія",
"tryApp.createFromSampleApp": "Створити з цього зразка додатку",
+ "tryApp.loadError": "Не вдалося завантажити цей шаблон",
"tryApp.requirements": "Вимоги",
+ "tryApp.retrying": "Повторна спроба…",
"tryApp.tabHeader.detail": "Деталі оркестрації",
"tryApp.tabHeader.try": "Спробувати",
"tryApp.tryInfo": "Це зразок додатку. Ви можете спробувати до 5 повідомлень. Щоб продовжити користуватися ним, натисніть «Створити з цього зразка додатку» та налаштуйте його!"
diff --git a/web/i18n/locales/vi-VN/explore.json b/web/i18n/locales/vi-VN/explore.json
index 8e55fdb5f4b..e5051131b8f 100644
--- a/web/i18n/locales/vi-VN/explore.json
+++ b/web/i18n/locales/vi-VN/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "Ứng dụng web",
"tryApp.category": "Danh mục",
"tryApp.createFromSampleApp": "Tạo từ ứng dụng mẫu này",
+ "tryApp.loadError": "Không thể tải mẫu này",
"tryApp.requirements": "Yêu cầu",
+ "tryApp.retrying": "Đang thử lại…",
"tryApp.tabHeader.detail": "Chi tiết điều phối",
"tryApp.tabHeader.try": "Dùng thử",
"tryApp.tryInfo": "Đây là ứng dụng mẫu. Bạn có thể thử tối đa 5 tin nhắn. Để tiếp tục sử dụng, hãy nhấp vào \"Tạo từ ứng dụng mẫu này\" và thiết lập nó!"
diff --git a/web/i18n/locales/zh-Hans/explore.json b/web/i18n/locales/zh-Hans/explore.json
index 67d8191cc91..fcc2c32f825 100644
--- a/web/i18n/locales/zh-Hans/explore.json
+++ b/web/i18n/locales/zh-Hans/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "WEB APPS",
"tryApp.category": "分类",
"tryApp.createFromSampleApp": "从此模板创建应用",
+ "tryApp.loadError": "无法加载此模板",
"tryApp.requirements": "必须配置项",
+ "tryApp.retrying": "正在重试…",
"tryApp.tabHeader.detail": "编排详情",
"tryApp.tabHeader.try": "试用",
"tryApp.tryInfo": "这是一个示例应用,您可以试用最多 5 条消息。如需继续使用,请点击 “从此模板创建应用” 并完成配置!"
diff --git a/web/i18n/locales/zh-Hant/explore.json b/web/i18n/locales/zh-Hant/explore.json
index f57c5636561..11edb9c1f7f 100644
--- a/web/i18n/locales/zh-Hant/explore.json
+++ b/web/i18n/locales/zh-Hant/explore.json
@@ -36,7 +36,9 @@
"sidebar.webApps": "WEB APPS",
"tryApp.category": "分類",
"tryApp.createFromSampleApp": "從此範本建立應用",
+ "tryApp.loadError": "無法載入此範本",
"tryApp.requirements": "必須配置項",
+ "tryApp.retrying": "正在重試…",
"tryApp.tabHeader.detail": "編排詳情",
"tryApp.tabHeader.try": "試用",
"tryApp.tryInfo": "這是一個範例應用程式,您可以試用最多 5 則訊息。如需繼續使用,請點擊「從此範本建立應用」並完成設定!"
diff --git a/web/service/try-app.ts b/web/service/try-app.ts
index d0d0d2bbcdb..384f34efb56 100644
--- a/web/service/try-app.ts
+++ b/web/service/try-app.ts
@@ -296,10 +296,6 @@ export const fetchTryAppDatasets = (appId: string, ids: string[]) => {
})
}
-export const fetchTryAppFlowPreview = (appId: string) => {
- return consoleClient.trialApps.byAppId.workflows.get({ params: { app_id: appId } })
-}
-
export const fetchTryAppParams = (appId: string) => {
return consoleClient.trialApps.byAppId.parameters
.get({ params: { app_id: appId } })
diff --git a/web/service/use-try-app.ts b/web/service/use-try-app.ts
index cdf447909a0..f0bd57ac0ad 100644
--- a/web/service/use-try-app.ts
+++ b/web/service/use-try-app.ts
@@ -1,11 +1,6 @@
import { useQuery } from '@tanstack/react-query'
import { consoleQuery } from '@/service/console'
-import {
- fetchTryAppDatasets,
- fetchTryAppFlowPreview,
- fetchTryAppInfo,
- fetchTryAppParams,
-} from './try-app'
+import { fetchTryAppDatasets, fetchTryAppInfo, fetchTryAppParams } from './try-app'
export const useGetTryAppInfo = (appId: string) => {
return useQuery({
@@ -40,15 +35,3 @@ export const useGetTryAppDataSets = (appId: string, ids: string[]) => {
enabled: ids.length > 0,
})
}
-
-export const useGetTryAppFlowPreview = (appId: string, disabled?: boolean) => {
- return useQuery({
- queryKey: consoleQuery.trialApps.byAppId.workflows.get.queryKey({
- input: { params: { app_id: appId } },
- }),
- enabled: !disabled,
- queryFn: () => {
- return fetchTryAppFlowPreview(appId)
- },
- })
-}