feat: add reasoning format processing to LLMNode for <think> tag handling (#23313)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
taewoong Kim
2025-09-05 19:15:35 +09:00
committed by GitHub
parent 05cd7e2d8a
commit edf4a1b652
30 changed files with 366 additions and 5 deletions

View File

@@ -0,0 +1,40 @@
import type { FC } from 'react'
import React from 'react'
import { useTranslation } from 'react-i18next'
import Field from '@/app/components/workflow/nodes/_base/components/field'
import Switch from '@/app/components/base/switch'
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('workflow.nodes.llm.reasoningFormat.title')}
tooltip={t('workflow.nodes.llm.reasoningFormat.tooltip')}
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