wwf
2025-05-20 938c3e5a587ce950a94964ea509b9e7f8834dfae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'use client'
import type { FC } from 'react'
import React, { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { ReasoningModeType } from '../types'
import Field from '../../_base/components/field'
import OptionCard from '../../_base/components/option-card'
 
const i18nPrefix = 'workflow.nodes.parameterExtractor'
 
type Props = {
  type: ReasoningModeType
  onChange: (type: ReasoningModeType) => void
}
 
const ReasoningModePicker: FC<Props> = ({
  type,
  onChange,
}) => {
  const { t } = useTranslation()
 
  const handleChange = useCallback((type: ReasoningModeType) => {
    return () => {
      onChange(type)
    }
  }, [onChange])
 
  return (
    <Field
      title={t(`${i18nPrefix}.reasoningMode`)}
      tooltip={t(`${i18nPrefix}.reasoningModeTip`)!}
    >
      <div className='grid grid-cols-2 gap-x-1'>
        <OptionCard
          title='Function/Tool Calling'
          onSelect={handleChange(ReasoningModeType.functionCall)}
          selected={type === ReasoningModeType.functionCall}
        />
        <OptionCard
          title='Prompt'
          selected={type === ReasoningModeType.prompt}
          onSelect={handleChange(ReasoningModeType.prompt)}
        />
      </div>
    </Field>
 
  )
}
export default React.memo(ReasoningModePicker)