Revert "Merge branch 'zhsama/remove-reasoning-ui' into feat/support-agent-sandbox"

This reverts commit f6b0fda9f7, reversing
changes made to f359bbc5de.
This commit is contained in:
zhsama
2026-02-11 18:05:18 +08:00
parent 2bf767d5f7
commit 17ba8af331
26 changed files with 147 additions and 0 deletions

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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,
}