mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 09:58:04 +08:00
chore: add i18n
This commit is contained in:
@ -13,7 +13,13 @@ const AgentNode: FC<NodeProps<AgentNodeType>> = (props) => {
|
||||
const { t } = useTranslation()
|
||||
return <div className='mb-1 px-3 py-1 space-y-1'>
|
||||
{inputs.agent_strategy_name
|
||||
? <SettingItem label='Strategy' status='error' tooltip='ReAct is not installed'>
|
||||
? <SettingItem
|
||||
label={t('workflow.nodes.agent.strategy.shortLabel')}
|
||||
status='error'
|
||||
tooltip={t('workflow.nodes.agent.strategyNotInstallTooltip', {
|
||||
strategy: inputs.agent_strategy_name,
|
||||
})}
|
||||
>
|
||||
{inputs.agent_strategy_name}
|
||||
</SettingItem>
|
||||
: <SettingItem label={t('workflow.nodes.agent.strategyNotSet')} />}
|
||||
@ -40,8 +46,18 @@ const AgentNode: FC<NodeProps<AgentNodeType>> = (props) => {
|
||||
</GroupLabel>}>
|
||||
<div className='grid grid-cols-10 gap-0.5'>
|
||||
<ToolIcon src='/logo/logo.png' />
|
||||
<ToolIcon src='/logo/logo.png' status='error' tooltip='Gmail Sender is not installed' />
|
||||
<ToolIcon src='/logo/logo.png' status='warning' tooltip='DuckDuckGo AI Search Not Authorized' />
|
||||
<ToolIcon
|
||||
src='/logo/logo.png'
|
||||
status='error'
|
||||
tooltip={t('workflow.nodes.agent.toolNotInstallTooltip', {
|
||||
tool: 'Gmail Sender',
|
||||
})} />
|
||||
<ToolIcon
|
||||
src='/logo/logo.png'
|
||||
status='warning'
|
||||
tooltip={t('workflow.nodes.agent.toolNotAuthorizedTooltip', {
|
||||
tool: 'DuckDuckGo AI Search',
|
||||
})} />
|
||||
</div>
|
||||
</Group>
|
||||
</div>
|
||||
|
||||
@ -4,8 +4,9 @@ import type { AgentNodeType } from './types'
|
||||
import Field from '../_base/components/field'
|
||||
import { InputNumber } from '@/app/components/base/input-number'
|
||||
import Slider from '@/app/components/base/slider'
|
||||
import useNodeCrud from '../_base/hooks/use-node-crud'
|
||||
import { AgentStrategy } from '../_base/components/agent-strategy'
|
||||
import useConfig from './use-config'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
const mockSchema = [
|
||||
{
|
||||
@ -260,7 +261,8 @@ const mockSchema = [
|
||||
] as const
|
||||
|
||||
const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
|
||||
const { inputs, setInputs } = useNodeCrud(props.id, props.data)
|
||||
const { inputs, setInputs } = useConfig(props.id, props.data)
|
||||
const { t } = useTranslation()
|
||||
const [iter, setIter] = [inputs.max_iterations, (value: number) => {
|
||||
setInputs({
|
||||
...inputs,
|
||||
@ -268,7 +270,7 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
|
||||
})
|
||||
}]
|
||||
return <div className='space-y-2 my-2'>
|
||||
<Field title={'Strategy'} className='px-4' >
|
||||
<Field title={t('workflow.nodes.agent.strategy.label')} className='px-4' >
|
||||
<AgentStrategy
|
||||
strategy={inputs.agent_strategy_name ? {
|
||||
agent_strategy_provider_name: inputs.agent_strategy_provider_name!,
|
||||
@ -291,10 +293,10 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
|
||||
})}
|
||||
/>
|
||||
</Field>
|
||||
<Field title={'tools'} className='px-4'>
|
||||
<Field title={t('workflow.nodes.agent.tools')} className='px-4'>
|
||||
|
||||
</Field>
|
||||
<Field title={'max iterations'} tooltip={'max iter'} inline className='px-4'>
|
||||
<Field title={t('workflow.nodes.agent.maxIterations')} tooltip={'max iter'} inline className='px-4'>
|
||||
<div className='flex w-[200px] items-center gap-3'>
|
||||
<Slider value={iter} onChange={setIter} className='w-full' min={1} max={10} />
|
||||
<InputNumber
|
||||
|
||||
@ -17,6 +17,7 @@ const useConfig = (id: string, payload: AgentNodeType) => {
|
||||
return {
|
||||
readOnly,
|
||||
inputs,
|
||||
setInputs,
|
||||
handleVarListChange,
|
||||
handleAddVariable,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user