mirror of https://github.com/langgenius/dify.git
fix(trigger): subscription removed in workflow
This commit is contained in:
parent
439727746c
commit
18a52b4937
|
|
@ -25,7 +25,7 @@ import Tooltip from '@/app/components/base/tooltip'
|
|||
import PromptEditor from '@/app/components/base/prompt-editor'
|
||||
import ConfigContext from '@/context/debug-configuration'
|
||||
import { getNewVar, getVars } from '@/utils/var'
|
||||
import { AppType } from '@/types/app'
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
import { useModalContext } from '@/context/modal-context'
|
||||
import type { ExternalDataTool } from '@/models/common'
|
||||
import { useToastContext } from '@/app/components/base/toast'
|
||||
|
|
@ -100,7 +100,7 @@ const AdvancedPromptInput: FC<Props> = ({
|
|||
},
|
||||
})
|
||||
}
|
||||
const isChatApp = mode !== AppType.completion
|
||||
const isChatApp = mode !== AppModeEnum.COMPLETION
|
||||
const [isCopied, setIsCopied] = React.useState(false)
|
||||
|
||||
const promptVariablesObj = (() => {
|
||||
|
|
|
|||
|
|
@ -12,11 +12,13 @@ import Button from '@/app/components/base/button'
|
|||
import AdvancedMessageInput from '@/app/components/app/configuration/config-prompt/advanced-prompt-input'
|
||||
import { PromptRole } from '@/models/debug'
|
||||
import type { PromptItem, PromptVariable } from '@/models/debug'
|
||||
import { type AppType, ModelModeType } from '@/types/app'
|
||||
import type { AppModeEnum } from '@/types/app'
|
||||
import { ModelModeType } from '@/types/app'
|
||||
import ConfigContext from '@/context/debug-configuration'
|
||||
import { MAX_PROMPT_MESSAGE_LENGTH } from '@/config'
|
||||
|
||||
export type IPromptProps = {
|
||||
mode: AppType
|
||||
mode: AppModeEnum
|
||||
promptTemplate: string
|
||||
promptVariables: PromptVariable[]
|
||||
readonly?: boolean
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import PromptEditorHeightResizeWrap from './prompt-editor-height-resize-wrap'
|
|||
import cn from '@/utils/classnames'
|
||||
import type { PromptVariable } from '@/models/debug'
|
||||
import Tooltip from '@/app/components/base/tooltip'
|
||||
import { AppType } from '@/types/app'
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
import { getNewVar, getVars } from '@/utils/var'
|
||||
import AutomaticBtn from '@/app/components/app/configuration/config/automatic/automatic-btn'
|
||||
import type { GenRes } from '@/service/debug'
|
||||
|
|
@ -29,7 +29,7 @@ import { useFeaturesStore } from '@/app/components/base/features/hooks'
|
|||
import { noop } from 'lodash-es'
|
||||
|
||||
export type ISimplePromptInput = {
|
||||
mode: AppType
|
||||
mode: AppModeEnum
|
||||
promptTemplate: string
|
||||
promptVariables: PromptVariable[]
|
||||
readonly?: boolean
|
||||
|
|
@ -153,7 +153,7 @@ const Prompt: FC<ISimplePromptInput> = ({
|
|||
setModelConfig(newModelConfig)
|
||||
setPrevPromptConfig(modelConfig.configs)
|
||||
|
||||
if (mode !== AppType.completion) {
|
||||
if (mode !== AppModeEnum.COMPLETION) {
|
||||
setIntroduction(res.opening_statement || '')
|
||||
const newFeatures = produce(features, (draft) => {
|
||||
draft.opening = {
|
||||
|
|
@ -175,7 +175,7 @@ const Prompt: FC<ISimplePromptInput> = ({
|
|||
{!noTitle && (
|
||||
<div className="flex h-11 items-center justify-between pl-3 pr-2.5">
|
||||
<div className="flex items-center space-x-1">
|
||||
<div className='h2 system-sm-semibold-uppercase text-text-secondary'>{mode !== AppType.completion ? t('appDebug.chatSubTitle') : t('appDebug.completionSubTitle')}</div>
|
||||
<div className='h2 system-sm-semibold-uppercase text-text-secondary'>{mode !== AppModeEnum.COMPLETION ? t('appDebug.chatSubTitle') : t('appDebug.completionSubTitle')}</div>
|
||||
{!readonly && (
|
||||
<Tooltip
|
||||
popupContent={
|
||||
|
|
@ -274,7 +274,7 @@ const Prompt: FC<ISimplePromptInput> = ({
|
|||
{showAutomatic && (
|
||||
<GetAutomaticResModal
|
||||
flowId={appId}
|
||||
mode={mode as AppType}
|
||||
mode={mode as AppModeEnum}
|
||||
isShow={showAutomatic}
|
||||
onClose={showAutomaticFalse}
|
||||
onFinished={handleAutomaticRes}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import { getNewVar, hasDuplicateStr } from '@/utils/var'
|
|||
import Toast from '@/app/components/base/toast'
|
||||
import Confirm from '@/app/components/base/confirm'
|
||||
import ConfigContext from '@/context/debug-configuration'
|
||||
import { AppType } from '@/types/app'
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
import type { ExternalDataTool } from '@/models/common'
|
||||
import { useModalContext } from '@/context/modal-context'
|
||||
import { useEventEmitterContextContext } from '@/context/event-emitter'
|
||||
|
|
@ -199,7 +199,7 @@ const ConfigVar: FC<IConfigVarProps> = ({ promptVariables, readonly, onPromptVar
|
|||
const handleRemoveVar = (index: number) => {
|
||||
const removeVar = promptVariables[index]
|
||||
|
||||
if (mode === AppType.completion && dataSets.length > 0 && removeVar.is_context_var) {
|
||||
if (mode === AppModeEnum.COMPLETION && dataSets.length > 0 && removeVar.is_context_var) {
|
||||
showDeleteContextVarModal()
|
||||
setRemoveIndex(index)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -19,8 +19,7 @@ import Modal from '@/app/components/base/modal'
|
|||
import Button from '@/app/components/base/button'
|
||||
import Toast from '@/app/components/base/toast'
|
||||
import { generateBasicAppFirstTimeRule, generateRule } from '@/service/debug'
|
||||
import type { CompletionParams, Model } from '@/types/app'
|
||||
import type { AppType } from '@/types/app'
|
||||
import type { AppModeEnum, CompletionParams, Model } from '@/types/app'
|
||||
import Loading from '@/app/components/base/loading'
|
||||
import Confirm from '@/app/components/base/confirm'
|
||||
|
||||
|
|
@ -44,7 +43,7 @@ import { useGenerateRuleTemplate } from '@/service/use-apps'
|
|||
|
||||
const i18nPrefix = 'appDebug.generate'
|
||||
export type IGetAutomaticResProps = {
|
||||
mode: AppType
|
||||
mode: AppModeEnum
|
||||
isShow: boolean
|
||||
onClose: () => void
|
||||
onFinished: (res: GenRes) => void
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import { useTranslation } from 'react-i18next'
|
|||
import { languageMap } from '../../../../workflow/nodes/_base/components/editor/code-editor/index'
|
||||
import { generateRule } from '@/service/debug'
|
||||
import type { GenRes } from '@/service/debug'
|
||||
import type { ModelModeType } from '@/types/app'
|
||||
import type { AppType, CompletionParams, Model } from '@/types/app'
|
||||
import type { AppModeEnum, ModelModeType } from '@/types/app'
|
||||
import type { CompletionParams, Model } from '@/types/app'
|
||||
import Modal from '@/app/components/base/modal'
|
||||
import Button from '@/app/components/base/button'
|
||||
import { Generator } from '@/app/components/base/icons/src/vender/other'
|
||||
|
|
@ -33,7 +33,7 @@ export type IGetCodeGeneratorResProps = {
|
|||
flowId: string
|
||||
nodeId: string
|
||||
currentCode?: string
|
||||
mode: AppType
|
||||
mode: AppModeEnum
|
||||
isShow: boolean
|
||||
codeLanguages: CodeLanguage
|
||||
onClose: () => void
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ import ConfigContext from '@/context/debug-configuration'
|
|||
import ConfigPrompt from '@/app/components/app/configuration/config-prompt'
|
||||
import ConfigVar from '@/app/components/app/configuration/config-var'
|
||||
import type { ModelConfig, PromptVariable } from '@/models/debug'
|
||||
import type { AppType } from '@/types/app'
|
||||
import { ModelModeType } from '@/types/app'
|
||||
import { AppModeEnum, ModelModeType } from '@/types/app'
|
||||
|
||||
const Config: FC = () => {
|
||||
const {
|
||||
|
|
@ -29,7 +28,7 @@ const Config: FC = () => {
|
|||
setModelConfig,
|
||||
setPrevPromptConfig,
|
||||
} = useContext(ConfigContext)
|
||||
const isChatApp = ['advanced-chat', 'agent-chat', 'chat'].includes(mode)
|
||||
const isChatApp = [AppModeEnum.ADVANCED_CHAT, AppModeEnum.AGENT_CHAT, AppModeEnum.CHAT].includes(mode)
|
||||
const formattingChangedDispatcher = useFormattingChangedDispatcher()
|
||||
|
||||
const promptTemplate = modelConfig.configs.prompt_template
|
||||
|
|
@ -62,7 +61,7 @@ const Config: FC = () => {
|
|||
>
|
||||
{/* Template */}
|
||||
<ConfigPrompt
|
||||
mode={mode as AppType}
|
||||
mode={mode}
|
||||
promptTemplate={promptTemplate}
|
||||
promptVariables={promptVariables}
|
||||
onChange={handlePromptChange}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import {
|
|||
APP_CHAT_WITH_MULTIPLE_MODEL,
|
||||
APP_CHAT_WITH_MULTIPLE_MODEL_RESTART,
|
||||
} from './types'
|
||||
import { AppType, ModelModeType, TransferMethod } from '@/types/app'
|
||||
import { AppModeEnum, ModelModeType, TransferMethod } from '@/types/app'
|
||||
import ChatUserInput from '@/app/components/app/configuration/debug/chat-user-input'
|
||||
import PromptValuePanel from '@/app/components/app/configuration/prompt-value-panel'
|
||||
import ConfigContext from '@/context/debug-configuration'
|
||||
|
|
@ -142,7 +142,7 @@ const Debug: FC<IDebug> = ({
|
|||
const [completionFiles, setCompletionFiles] = useState<VisionFile[]>([])
|
||||
|
||||
const checkCanSend = useCallback(() => {
|
||||
if (isAdvancedMode && mode !== AppType.completion) {
|
||||
if (isAdvancedMode && mode !== AppModeEnum.COMPLETION) {
|
||||
if (modelModeType === ModelModeType.completion) {
|
||||
if (!hasSetBlockStatus.history) {
|
||||
notify({ type: 'error', message: t('appDebug.otherError.historyNoBeEmpty') })
|
||||
|
|
@ -411,7 +411,7 @@ const Debug: FC<IDebug> = ({
|
|||
)
|
||||
: null
|
||||
}
|
||||
{mode !== AppType.completion && (
|
||||
{mode !== AppModeEnum.COMPLETION && (
|
||||
<>
|
||||
<TooltipPlus
|
||||
popupContent={t('common.operation.refresh')}
|
||||
|
|
@ -436,14 +436,14 @@ const Debug: FC<IDebug> = ({
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
{mode !== AppType.completion && expanded && (
|
||||
{mode !== AppModeEnum.COMPLETION && expanded && (
|
||||
<div className='mx-3'>
|
||||
<ChatUserInput inputs={inputs} />
|
||||
</div>
|
||||
)}
|
||||
{mode === AppType.completion && (
|
||||
{mode === AppModeEnum.COMPLETION && (
|
||||
<PromptValuePanel
|
||||
appType={mode as AppType}
|
||||
appType={mode as AppModeEnum}
|
||||
onSend={handleSendTextCompletion}
|
||||
inputs={inputs}
|
||||
visionConfig={{
|
||||
|
|
@ -491,7 +491,7 @@ const Debug: FC<IDebug> = ({
|
|||
!debugWithMultipleModel && (
|
||||
<div className="flex grow flex-col" ref={ref}>
|
||||
{/* Chat */}
|
||||
{mode !== AppType.completion && (
|
||||
{mode !== AppModeEnum.COMPLETION && (
|
||||
<div className='h-0 grow overflow-hidden'>
|
||||
<DebugWithSingleModel
|
||||
ref={debugWithSingleModelRef}
|
||||
|
|
@ -500,7 +500,7 @@ const Debug: FC<IDebug> = ({
|
|||
</div>
|
||||
)}
|
||||
{/* Text Generation */}
|
||||
{mode === AppType.completion && (
|
||||
{mode === AppModeEnum.COMPLETION && (
|
||||
<>
|
||||
{(completionRes || isResponding) && (
|
||||
<>
|
||||
|
|
@ -529,7 +529,7 @@ const Debug: FC<IDebug> = ({
|
|||
)}
|
||||
</>
|
||||
)}
|
||||
{mode === AppType.completion && showPromptLogModal && (
|
||||
{mode === AppModeEnum.COMPLETION && showPromptLogModal && (
|
||||
<PromptLogModal
|
||||
width={width}
|
||||
currentLogItem={currentLogItem}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
} from '@remixicon/react'
|
||||
import ConfigContext from '@/context/debug-configuration'
|
||||
import type { Inputs } from '@/models/debug'
|
||||
import { AppType, ModelModeType } from '@/types/app'
|
||||
import { AppModeEnum, ModelModeType } from '@/types/app'
|
||||
import Select from '@/app/components/base/select'
|
||||
import Button from '@/app/components/base/button'
|
||||
import Input from '@/app/components/base/input'
|
||||
|
|
@ -25,7 +25,7 @@ import cn from '@/utils/classnames'
|
|||
import BoolInput from '@/app/components/workflow/nodes/_base/components/before-run-form/bool-input'
|
||||
|
||||
export type IPromptValuePanelProps = {
|
||||
appType: AppType
|
||||
appType: AppModeEnum
|
||||
onSend?: () => void
|
||||
inputs: Inputs
|
||||
visionConfig: VisionSettings
|
||||
|
|
@ -55,7 +55,7 @@ const PromptValuePanel: FC<IPromptValuePanelProps> = ({
|
|||
}, [promptVariables])
|
||||
|
||||
const canNotRun = useMemo(() => {
|
||||
if (mode !== AppType.completion)
|
||||
if (mode !== AppModeEnum.COMPLETION)
|
||||
return true
|
||||
|
||||
if (isAdvancedMode) {
|
||||
|
|
@ -215,7 +215,7 @@ const PromptValuePanel: FC<IPromptValuePanelProps> = ({
|
|||
<div className='mx-3'>
|
||||
<FeatureBar
|
||||
showFileUpload={false}
|
||||
isChatMode={appType !== AppType.completion}
|
||||
isChatMode={appType !== AppModeEnum.COMPLETION}
|
||||
onFeatureBarClick={setShowAppConfigureFeaturesModal} />
|
||||
</div>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ import Loading from '@/app/components/base/loading'
|
|||
import { useProviderContext } from '@/context/provider-context'
|
||||
import { PROVIDER_WITH_PRESET_TONE, STOP_PARAMETER_RULE, TONE_LIST } from '@/config'
|
||||
import { ArrowNarrowLeft } from '@/app/components/base/icons/src/vender/line/arrows'
|
||||
import type { AppModeEnum } from '@/types/app'
|
||||
import type { ModelModeType } from '@/types/app'
|
||||
|
||||
export type ModelParameterModalProps = {
|
||||
popupClassName?: string
|
||||
portalToFollowElemContentClassName?: string
|
||||
isAdvancedMode: boolean
|
||||
mode: AppModeEnum
|
||||
mode: ModelModeType
|
||||
modelId: string
|
||||
provider: string
|
||||
setModel: (model: { modelId: string; provider: string; mode?: string; features?: string[] }) => void
|
||||
|
|
|
|||
|
|
@ -42,8 +42,17 @@ const SubscriptionTriggerButton: React.FC<SubscriptionTriggerButtonProps> = ({
|
|||
}
|
||||
}
|
||||
|
||||
const selectedSubscription = subscriptions?.find(sub => sub.id === selectedId)
|
||||
|
||||
if (!selectedSubscription) {
|
||||
return {
|
||||
label: t('pluginTrigger.subscription.subscriptionRemoved'),
|
||||
color: 'red' as const,
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
label: subscriptions?.find(sub => sub.id === selectedId)?.name || t('pluginTrigger.subscription.selectPlaceholder'),
|
||||
label: selectedSubscription.name,
|
||||
color: 'green' as const,
|
||||
}
|
||||
}, [selectedId, subscriptions, t, isOpen])
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import cn from 'classnames'
|
|||
import type { CodeLanguage } from '../../code/types'
|
||||
import { Generator } from '@/app/components/base/icons/src/vender/other'
|
||||
import { ActionButton } from '@/app/components/base/action-button'
|
||||
import { AppType } from '@/types/app'
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
import type { GenRes } from '@/service/debug'
|
||||
import { GetCodeGeneratorResModal } from '@/app/components/app/configuration/config/code-generator/get-code-generator-res'
|
||||
import { useHooksStore } from '../../../hooks-store'
|
||||
|
|
@ -42,7 +42,7 @@ const CodeGenerateBtn: FC<Props> = ({
|
|||
</ActionButton>
|
||||
{showAutomatic && (
|
||||
<GetCodeGeneratorResModal
|
||||
mode={AppType.chat}
|
||||
mode={AppModeEnum.CHAT}
|
||||
isShow={showAutomatic}
|
||||
codeLanguages={codeLanguages}
|
||||
onClose={showAutomaticFalse}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import cn from 'classnames'
|
|||
import { Generator } from '@/app/components/base/icons/src/vender/other'
|
||||
import { ActionButton } from '@/app/components/base/action-button'
|
||||
import GetAutomaticResModal from '@/app/components/app/configuration/config/automatic/get-automatic-res'
|
||||
import { AppType } from '@/types/app'
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
import type { GenRes } from '@/service/debug'
|
||||
import type { ModelConfig } from '@/app/components/workflow/types'
|
||||
import { useHooksStore } from '../../../hooks-store'
|
||||
|
|
@ -42,7 +42,7 @@ const PromptGeneratorBtn: FC<Props> = ({
|
|||
</ActionButton>
|
||||
{showAutomatic && (
|
||||
<GetAutomaticResModal
|
||||
mode={AppType.chat}
|
||||
mode={AppModeEnum.CHAT}
|
||||
isShow={showAutomatic}
|
||||
onClose={showAutomaticFalse}
|
||||
onFinished={handleAutomaticRes}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import useNodeInfo from '../nodes/_base/hooks/use-node-info'
|
|||
import { useBoolean } from 'ahooks'
|
||||
import GetAutomaticResModal from '@/app/components/app/configuration/config/automatic/get-automatic-res'
|
||||
import GetCodeGeneratorResModal from '../../app/configuration/config/code-generator/get-code-generator-res'
|
||||
import { AppType } from '@/types/app'
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
import { useHooksStore } from '../hooks-store'
|
||||
import { useCallback, useMemo } from 'react'
|
||||
import { useNodesInteractions, useToolIcon } from '../hooks'
|
||||
|
|
@ -282,7 +282,7 @@ const Right = ({
|
|||
isCodeBlock
|
||||
? <GetCodeGeneratorResModal
|
||||
isShow
|
||||
mode={AppType.chat}
|
||||
mode={AppModeEnum.CHAT}
|
||||
onClose={handleHidePromptGenerator}
|
||||
flowId={configsMap?.flowId || ''}
|
||||
nodeId={nodeId}
|
||||
|
|
@ -291,7 +291,7 @@ const Right = ({
|
|||
onFinished={handleUpdatePrompt}
|
||||
/>
|
||||
: <GetAutomaticResModal
|
||||
mode={AppType.chat}
|
||||
mode={AppModeEnum.CHAT}
|
||||
isShow
|
||||
onClose={handleHidePromptGenerator}
|
||||
onFinished={handleUpdatePrompt}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ const translation = {
|
|||
maxCount: 'Max {{num}} subscriptions',
|
||||
selectPlaceholder: 'Select subscription',
|
||||
noSubscriptionSelected: 'No subscription selected',
|
||||
subscriptionRemoved: 'Subscription removed',
|
||||
list: {
|
||||
title: 'Subscriptions',
|
||||
addButton: 'Add',
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ const translation = {
|
|||
maxCount: '最多 {{num}} 个订阅',
|
||||
selectPlaceholder: '选择订阅',
|
||||
noSubscriptionSelected: '未选择订阅',
|
||||
subscriptionRemoved: '订阅已移除',
|
||||
list: {
|
||||
title: '订阅列表',
|
||||
addButton: '添加',
|
||||
|
|
|
|||
Loading…
Reference in New Issue