mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
Revert "Merge branch 'zhsama/remove-reasoning-ui' into feat/support-agent-sandbox"
This reverts commitf6b0fda9f7, reversing changes made tof359bbc5de.
This commit is contained in:
@ -0,0 +1,40 @@
|
||||
import type { FC } from 'react'
|
||||
import * as React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import Switch from '@/app/components/base/switch'
|
||||
import Field from '@/app/components/workflow/nodes/_base/components/field'
|
||||
|
||||
type ReasoningFormatConfigProps = {
|
||||
value?: 'tagged' | 'separated'
|
||||
onChange: (value: 'tagged' | 'separated') => void
|
||||
readonly?: boolean
|
||||
}
|
||||
|
||||
const ReasoningFormatConfig: FC<ReasoningFormatConfigProps> = ({
|
||||
value = 'tagged',
|
||||
onChange,
|
||||
readonly = false,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<Field
|
||||
title={t('nodes.llm.reasoningFormat.title', { ns: 'workflow' })}
|
||||
tooltip={t('nodes.llm.reasoningFormat.tooltip', { ns: 'workflow' })}
|
||||
operations={(
|
||||
// ON = separated, OFF = tagged
|
||||
<Switch
|
||||
defaultValue={value === 'separated'}
|
||||
onChange={enabled => onChange(enabled ? 'separated' : 'tagged')}
|
||||
size="md"
|
||||
disabled={readonly}
|
||||
key={value}
|
||||
/>
|
||||
)}
|
||||
>
|
||||
<div />
|
||||
</Field>
|
||||
)
|
||||
}
|
||||
|
||||
export default ReasoningFormatConfig
|
||||
@ -23,6 +23,7 @@ import MemoryConfig from '../_base/components/memory-config'
|
||||
import VarReferencePicker from '../_base/components/variable/var-reference-picker'
|
||||
import ComputerUseConfig from './components/computer-use-config'
|
||||
import ConfigPrompt from './components/config-prompt'
|
||||
import ReasoningFormatConfig from './components/reasoning-format-config'
|
||||
import StructureOutput from './components/structure-output'
|
||||
import Tools from './components/tools'
|
||||
import MaxIterations from './components/tools/max-iterations'
|
||||
@ -71,6 +72,7 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
|
||||
handleStructureOutputEnableChange,
|
||||
handleStructureOutputChange,
|
||||
filterJinja2InputVar,
|
||||
handleReasoningFormatChange,
|
||||
isSupportSandbox,
|
||||
handleComputerUseChange,
|
||||
} = useConfig(id, data)
|
||||
@ -337,6 +339,13 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
|
||||
onChange={handleMaxIterationsChange}
|
||||
disabled={!isModelSupportToolCall}
|
||||
/>
|
||||
|
||||
{/* Reasoning Format */}
|
||||
<ReasoningFormatConfig
|
||||
value={inputs.reasoning_format || 'tagged'}
|
||||
onChange={handleReasoningFormatChange}
|
||||
readonly={readOnly}
|
||||
/>
|
||||
</div>
|
||||
</FieldCollapse>
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ export type LLMNodeType = CommonNodeType & {
|
||||
}
|
||||
structured_output_enabled?: boolean
|
||||
structured_output?: StructuredOutput
|
||||
reasoning_format?: 'tagged' | 'separated'
|
||||
tools?: ToolValue[]
|
||||
tool_settings?: ToolSetting[]
|
||||
max_iterations?: number
|
||||
|
||||
@ -362,6 +362,14 @@ const useConfig = (id: string, payload: LLMNodeType) => {
|
||||
return [VarType.arrayObject, VarType.array, VarType.number, VarType.string, VarType.secret, VarType.arrayString, VarType.arrayNumber, VarType.file, VarType.arrayFile].includes(varPayload.type)
|
||||
}, [])
|
||||
|
||||
// reasoning format
|
||||
const handleReasoningFormatChange = useCallback((reasoningFormat: 'tagged' | 'separated') => {
|
||||
const newInputs = produce(inputRef.current, (draft) => {
|
||||
draft.reasoning_format = reasoningFormat
|
||||
})
|
||||
setInputs(newInputs)
|
||||
}, [setInputs])
|
||||
|
||||
const {
|
||||
availableVars,
|
||||
availableNodesWithParent,
|
||||
@ -403,6 +411,7 @@ const useConfig = (id: string, payload: LLMNodeType) => {
|
||||
setStructuredOutputCollapsed,
|
||||
handleStructureOutputEnableChange,
|
||||
filterJinja2InputVar,
|
||||
handleReasoningFormatChange,
|
||||
isSupportSandbox,
|
||||
handleComputerUseChange,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user