mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 15:57:06 +08:00
feat: different app preview
This commit is contained in:
parent
18f2d24f8e
commit
cc02b78aca
@ -310,7 +310,7 @@ const DatasetConfig: FC<Props> = ({ readonly, hideMetadataFilter }) => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{mode === AppType.completion && dataSet.length > 0 && (
|
{!readonly && mode === AppType.completion && dataSet.length > 0 && (
|
||||||
<ContextVar
|
<ContextVar
|
||||||
value={selectedContextVar?.key}
|
value={selectedContextVar?.key}
|
||||||
options={promptVariablesToSelect}
|
options={promptVariablesToSelect}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import { useGetTryAppDataSets, useGetTryAppInfo } from '@/service/use-try-app'
|
|||||||
import { noop } from 'lodash'
|
import { noop } from 'lodash'
|
||||||
import { correctModelProvider, correctToolProvider } from '@/utils'
|
import { correctModelProvider, correctToolProvider } from '@/utils'
|
||||||
import { userInputsFormToPromptVariables } from '@/utils/model-config'
|
import { userInputsFormToPromptVariables } from '@/utils/model-config'
|
||||||
import { useTextGenerationCurrentProviderAndModelAndModelList } from '../../header/account-setting/model-provider-page/hooks'
|
import { useTextGenerationCurrentProviderAndModelAndModelList } from '../../../header/account-setting/model-provider-page/hooks'
|
||||||
import { useAllToolProviders } from '@/service/use-tools'
|
import { useAllToolProviders } from '@/service/use-tools'
|
||||||
import { basePath } from '@/utils/var'
|
import { basePath } from '@/utils/var'
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ const defaultModelConfig = {
|
|||||||
dataSets: [],
|
dataSets: [],
|
||||||
agentConfig: DEFAULT_AGENT_SETTING,
|
agentConfig: DEFAULT_AGENT_SETTING,
|
||||||
}
|
}
|
||||||
const Configuration: FC<Props> = ({
|
const BasicAppPreview: FC<Props> = ({
|
||||||
appId,
|
appId,
|
||||||
}) => {
|
}) => {
|
||||||
const media = useBreakpoints()
|
const media = useBreakpoints()
|
||||||
@ -358,4 +358,4 @@ const Configuration: FC<Props> = ({
|
|||||||
</ConfigContext.Provider>
|
</ConfigContext.Provider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export default React.memo(Configuration)
|
export default React.memo(BasicAppPreview)
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
'use client'
|
||||||
|
import type { FC } from 'react'
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
appId: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const FlowAppPreview: FC<Props> = ({
|
||||||
|
appId,
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{appId}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default React.memo(FlowAppPreview)
|
||||||
26
web/app/components/app/configuration/preview/index.tsx
Normal file
26
web/app/components/app/configuration/preview/index.tsx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
'use client'
|
||||||
|
import type { FC } from 'react'
|
||||||
|
import React from 'react'
|
||||||
|
import { useGetTryAppInfo } from '@/service/use-try-app'
|
||||||
|
import BasicAppPreview from './basic-app-preview'
|
||||||
|
import FlowAppPreview from './flow-app-preview'
|
||||||
|
import Loading from '@/app/components/base/loading'
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
appId: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const Preview: FC<Props> = ({
|
||||||
|
appId,
|
||||||
|
}) => {
|
||||||
|
const { data: appDetail, isLoading } = useGetTryAppInfo(appId)
|
||||||
|
const isBasicApp = appDetail ? ['agent-chat', 'chat', 'completion'].includes(appDetail.mode) : false
|
||||||
|
if (isLoading) {
|
||||||
|
return <div className='flex h-full items-center justify-center'>
|
||||||
|
<Loading type='area' />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
return isBasicApp ? <BasicAppPreview appId={appId} /> : <FlowAppPreview appId={appId} />
|
||||||
|
}
|
||||||
|
export default React.memo(Preview)
|
||||||
Loading…
Reference in New Issue
Block a user