mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 08:58:09 +08:00
merge main
This commit is contained in:
@ -15,7 +15,8 @@ import { noop } from 'lodash-es'
|
||||
import { basePath } from '@/utils/var'
|
||||
|
||||
// load file from local instead of cdn https://github.com/suren-atoyan/monaco-react/issues/482
|
||||
loader.config({ paths: { vs: `${basePath}/vs` } })
|
||||
if (typeof window !== 'undefined')
|
||||
loader.config({ paths: { vs: `${window.location.origin}${basePath}/vs` } })
|
||||
|
||||
const CODE_EDITOR_LINE_HEIGHT = 18
|
||||
|
||||
@ -161,6 +162,7 @@ const CodeEditor: FC<Props> = ({
|
||||
unicodeHighlight: {
|
||||
ambiguousCharacters: false,
|
||||
},
|
||||
stickyScroll: { enabled: false },
|
||||
}}
|
||||
onMount={handleEditorDidMount}
|
||||
/>
|
||||
|
||||
@ -42,7 +42,7 @@ import type { RAGPipelineVariable } from '@/models/pipeline'
|
||||
import type { WebhookTriggerNodeType } from '@/app/components/workflow/nodes/trigger-webhook/types'
|
||||
import type { PluginTriggerNodeType } from '@/app/components/workflow/nodes/trigger-plugin/types'
|
||||
import PluginTriggerNodeDefault from '@/app/components/workflow/nodes/trigger-plugin/default'
|
||||
|
||||
import type { CaseItem, Condition } from '@/app/components/workflow/nodes/if-else/types'
|
||||
import {
|
||||
AGENT_OUTPUT_STRUCT,
|
||||
FILE_STRUCT,
|
||||
@ -1305,10 +1305,7 @@ export const getNodeUsedVars = (node: Node): ValueSelector[] => {
|
||||
break
|
||||
}
|
||||
case BlockEnum.IfElse: {
|
||||
res
|
||||
= (data as IfElseNodeType).conditions?.map((c) => {
|
||||
return c.variable_selector || []
|
||||
}) || []
|
||||
res = []
|
||||
res.push(
|
||||
...((data as IfElseNodeType).cases || [])
|
||||
.flatMap(c => c.conditions || [])
|
||||
@ -1480,9 +1477,22 @@ export const getNodeUsedVarPassToServerKey = (
|
||||
break
|
||||
}
|
||||
case BlockEnum.IfElse: {
|
||||
const targetVar = (data as IfElseNodeType).conditions?.find(
|
||||
c => c.variable_selector?.join('.') === valueSelector.join('.'),
|
||||
)
|
||||
const findConditionInCases = (cases: CaseItem[]): Condition | undefined => {
|
||||
for (const caseItem of cases) {
|
||||
for (const condition of caseItem.conditions || []) {
|
||||
if (condition.variable_selector?.join('.') === valueSelector.join('.'))
|
||||
return condition
|
||||
|
||||
if (condition.sub_variable_condition) {
|
||||
const found = findConditionInCases([condition.sub_variable_condition])
|
||||
if (found)
|
||||
return found
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
const targetVar = findConditionInCases((data as IfElseNodeType).cases || [])
|
||||
if (targetVar) res = `#${valueSelector.join('.')}#`
|
||||
break
|
||||
}
|
||||
@ -1634,13 +1644,6 @@ export const updateNodeVars = (
|
||||
}
|
||||
case BlockEnum.IfElse: {
|
||||
const payload = data as IfElseNodeType
|
||||
if (payload.conditions) {
|
||||
payload.conditions = payload.conditions.map((c) => {
|
||||
if (c.variable_selector?.join('.') === oldVarSelector.join('.'))
|
||||
c.variable_selector = newVarSelector
|
||||
return c
|
||||
})
|
||||
}
|
||||
if (payload.cases) {
|
||||
payload.cases = payload.cases.map((caseItem) => {
|
||||
if (caseItem.conditions) {
|
||||
|
||||
@ -298,7 +298,7 @@ const BasePanel: FC<BasePanelProps> = ({
|
||||
const { setDetail } = usePluginStore()
|
||||
|
||||
useEffect(() => {
|
||||
if (currentTriggerPlugin?.subscription_constructor) {
|
||||
if (currentTriggerPlugin) {
|
||||
setDetail({
|
||||
name: currentTriggerPlugin.label[language],
|
||||
plugin_id: currentTriggerPlugin.plugin_id || '',
|
||||
|
||||
Reference in New Issue
Block a user