mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
refactor(trigger): refactor app mode type to enum
This commit is contained in:
@ -6,7 +6,7 @@ import AppInputsForm from '@/app/components/plugins/plugin-detail-panel/app-sele
|
||||
import { useAppDetail } from '@/service/use-apps'
|
||||
import { useAppWorkflow } from '@/service/use-workflow'
|
||||
import { useFileUploadConfig } from '@/service/use-common'
|
||||
import { Resolution } from '@/types/app'
|
||||
import { AppModeEnum, Resolution } from '@/types/app'
|
||||
import { FILE_EXTS } from '@/app/components/base/prompt-editor/constants'
|
||||
import type { App } from '@/types/app'
|
||||
import type { FileUpload } from '@/app/components/base/features/types'
|
||||
@ -30,7 +30,7 @@ const AppInputsPanel = ({
|
||||
}: Props) => {
|
||||
const { t } = useTranslation()
|
||||
const inputsRef = useRef<any>(value?.inputs || {})
|
||||
const isBasicApp = appDetail.mode !== 'advanced-chat' && appDetail.mode !== 'workflow'
|
||||
const isBasicApp = appDetail.mode !== AppModeEnum.ADVANCED_CHAT && appDetail.mode !== AppModeEnum.WORKFLOW
|
||||
const { data: fileUploadConfig } = useFileUploadConfig()
|
||||
const { data: currentApp, isFetching: isAppLoading } = useAppDetail(appDetail.id)
|
||||
const { data: currentWorkflow, isFetching: isWorkflowLoading } = useAppWorkflow(isBasicApp ? '' : appDetail.id)
|
||||
@ -77,7 +77,7 @@ const AppInputsPanel = ({
|
||||
required: false,
|
||||
}
|
||||
}
|
||||
if(item.checkbox) {
|
||||
if (item.checkbox) {
|
||||
return {
|
||||
...item.checkbox,
|
||||
type: 'checkbox',
|
||||
@ -148,7 +148,7 @@ const AppInputsPanel = ({
|
||||
}
|
||||
}) || []
|
||||
}
|
||||
if ((currentApp.mode === 'completion' || currentApp.mode === 'workflow') && basicAppFileConfig.enabled) {
|
||||
if ((currentApp.mode === AppModeEnum.COMPLETION || currentApp.mode === AppModeEnum.WORKFLOW) && basicAppFileConfig.enabled) {
|
||||
inputFormSchema.push({
|
||||
label: 'Image Upload',
|
||||
variable: '#image#',
|
||||
|
||||
@ -12,7 +12,7 @@ import type {
|
||||
} from '@floating-ui/react'
|
||||
import Input from '@/app/components/base/input'
|
||||
import AppIcon from '@/app/components/base/app-icon'
|
||||
import type { App } from '@/types/app'
|
||||
import { type App, AppModeEnum } from '@/types/app'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
type Props = {
|
||||
@ -118,15 +118,15 @@ const AppPicker: FC<Props> = ({
|
||||
|
||||
const getAppType = (app: App) => {
|
||||
switch (app.mode) {
|
||||
case 'advanced-chat':
|
||||
case AppModeEnum.ADVANCED_CHAT:
|
||||
return 'chatflow'
|
||||
case 'agent-chat':
|
||||
case AppModeEnum.AGENT_CHAT:
|
||||
return 'agent'
|
||||
case 'chat':
|
||||
case AppModeEnum.CHAT:
|
||||
return 'chat'
|
||||
case 'completion':
|
||||
case AppModeEnum.COMPLETION:
|
||||
return 'completion'
|
||||
case 'workflow':
|
||||
case AppModeEnum.WORKFLOW:
|
||||
return 'workflow'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user