mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 10:28:10 +08:00
refactor(trigger): refactor app mode type to enum
This commit is contained in:
@ -22,6 +22,7 @@ import type { Node } from 'reactflow'
|
||||
import type { PluginMeta } from '@/app/components/plugins/types'
|
||||
import { noop } from 'lodash-es'
|
||||
import { useDocLink } from '@/context/i18n'
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
|
||||
export type Strategy = {
|
||||
agent_strategy_provider_name: string
|
||||
@ -99,7 +100,7 @@ export const AgentStrategy = memo((props: AgentStrategyProps) => {
|
||||
modelConfig={
|
||||
defaultModel.data
|
||||
? {
|
||||
mode: 'chat',
|
||||
mode: AppModeEnum.CHAT,
|
||||
name: defaultModel.data.model,
|
||||
provider: defaultModel.data.provider.provider,
|
||||
completion_params: {},
|
||||
|
||||
@ -63,6 +63,7 @@ import type { PromptItem } from '@/models/debug'
|
||||
import { VAR_REGEX } from '@/config'
|
||||
import type { AgentNodeType } from '../../../agent/types'
|
||||
import type { SchemaTypeDefinition } from '@/service/use-common'
|
||||
import { AppModeEnum } from '@/types/app'
|
||||
|
||||
export const isSystemVar = (valueSelector: ValueSelector) => {
|
||||
return valueSelector[0] === 'sys' || valueSelector[1] === 'sys'
|
||||
@ -1278,7 +1279,7 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {
|
||||
}
|
||||
case BlockEnum.LLM: {
|
||||
const payload = data as LLMNodeType
|
||||
const isChatModel = payload.model?.mode === 'chat'
|
||||
const isChatModel = payload.model?.mode === AppModeEnum.CHAT
|
||||
let prompts: string[] = []
|
||||
if (isChatModel) {
|
||||
prompts
|
||||
@ -1581,7 +1582,7 @@ export const updateNodeVars = (
|
||||
}
|
||||
case BlockEnum.LLM: {
|
||||
const payload = data as LLMNodeType
|
||||
const isChatModel = payload.model?.mode === 'chat'
|
||||
const isChatModel = payload.model?.mode === AppModeEnum.CHAT
|
||||
if (isChatModel) {
|
||||
payload.prompt_template = (
|
||||
payload.prompt_template as PromptItem[]
|
||||
|
||||
Reference in New Issue
Block a user