mirror of https://github.com/langgenius/dify.git
feat: try app page
This commit is contained in:
parent
d4bd19f6d8
commit
e54efda36f
|
|
@ -0,0 +1,17 @@
|
|||
import React from 'react'
|
||||
import Main from '@/app/components/try/app/index'
|
||||
|
||||
export type IInstalledAppProps = {
|
||||
params: {
|
||||
appId: string
|
||||
}
|
||||
}
|
||||
|
||||
async function InstalledApp({ params }: IInstalledAppProps) {
|
||||
const appId = (await params).appId
|
||||
return (
|
||||
<Main appId={appId} />
|
||||
)
|
||||
}
|
||||
|
||||
export default InstalledApp
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import React from 'react'
|
||||
import ChatWrapper from '@/app/components/base/chat/embedded-chatbot/chat-wrapper'
|
||||
import { useThemeContext } from '../../base/chat/embedded-chatbot/theme/theme-context'
|
||||
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
|
||||
import {
|
||||
EmbeddedChatbotContext,
|
||||
} from '@/app/components/base/chat/embedded-chatbot/context'
|
||||
import {
|
||||
useEmbeddedChatbot,
|
||||
} from '@/app/components/base/chat/embedded-chatbot/hooks'
|
||||
import cn from '@/utils/classnames'
|
||||
|
||||
type Props = {
|
||||
appId: string
|
||||
className: string
|
||||
}
|
||||
|
||||
const TryApp: FC<Props> = ({
|
||||
appId,
|
||||
className,
|
||||
}) => {
|
||||
const media = useBreakpoints()
|
||||
const isMobile = media === MediaType.mobile
|
||||
const themeBuilder = useThemeContext()
|
||||
const chatData = useEmbeddedChatbot()
|
||||
return (
|
||||
<EmbeddedChatbotContext.Provider value={{
|
||||
...chatData,
|
||||
isMobile,
|
||||
themeBuilder,
|
||||
}}>
|
||||
<div className={cn('bg-background-section-burn', className)}>
|
||||
<ChatWrapper />
|
||||
</div>
|
||||
</EmbeddedChatbotContext.Provider>
|
||||
)
|
||||
}
|
||||
export default React.memo(TryApp)
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import React from 'react'
|
||||
import Chat from './chat'
|
||||
|
||||
type Props = {
|
||||
appId: string
|
||||
}
|
||||
|
||||
const TryApp: FC<Props> = ({
|
||||
appId,
|
||||
}) => {
|
||||
const isChat = true
|
||||
const isCompletion = !isChat
|
||||
return (
|
||||
<div className='flex h-full'>
|
||||
{isChat && (
|
||||
<Chat appId={appId} className='h-full grow' />
|
||||
)}
|
||||
{isCompletion && (
|
||||
<div>Completion</div>
|
||||
)}
|
||||
<div className='w-[360px]'>
|
||||
Right panel
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default React.memo(TryApp)
|
||||
Loading…
Reference in New Issue