chore: add i18n

This commit is contained in:
AkaraChen 2024-12-25 14:05:49 +08:00
parent da6d65b072
commit a8a956b5f1
6 changed files with 30 additions and 17 deletions

View File

@ -11,15 +11,16 @@ import ViewTypeSelect, { ViewType } from '../../../block-selector/view-type-sele
import SearchInput from '@/app/components/base/search-input'
import { MARKETPLACE_URL_PREFIX } from '@/config'
import Tools from '../../../block-selector/tools'
import { useTranslation } from 'react-i18next'
const ExternalNotInstallWarn = () => {
// TODO: add i18n label
const { t } = useTranslation()
return <Tooltip
popupContent={<div className='space-y-1 text-xs'>
<h3 className='text-text-primary font-semibold'>This plugin is not installed</h3>
<p className='text-text-secondary tracking-tight'>This plugin is installed from GitHub. Please go to Plugins to reinstall</p>
<h3 className='text-text-primary font-semibold'>{t('workflow.nodes.agent.pluginNotInstalled')}</h3>
<p className='text-text-secondary tracking-tight'>{t('workflow.nodes.agent.pluginNotInstalledDesc')}</p>
<p>
<Link href={'/plugins'} className='text-text-accent tracking-tight'>Link to Plugins</Link>
<Link href={'/plugins'} className='text-text-accent tracking-tight'>{t('workflow.nodes.agent.linkToPlugin')}</Link>
</p>
</div>}
needsDelay

View File

@ -4,7 +4,7 @@ import ListEmpty from '@/app/components/base/list-empty'
import { AgentStrategySelector } from './agent-strategy-selector'
import Link from 'next/link'
import { useTranslation } from 'react-i18next'
import InputVarList from '../../tool/components/input-var-list'
import Form from '@/app/components/header/account-setting/model-provider-page/model-modal/Form'
export type Strategy = {
agent_strategy_provider_name: string
@ -19,26 +19,24 @@ export type AgentStrategyProps = {
formSchema: CredentialFormSchema[]
formValue: ToolVarInputs
onFormValueChange: (value: ToolVarInputs) => void
/**
* @description use for get available vars
*/
nodeId: string
}
export const AgentStrategy = (props: AgentStrategyProps) => {
const { strategy, onStrategyChange, formSchema, formValue, onFormValueChange, nodeId } = props
const { strategy, onStrategyChange, formSchema, formValue, onFormValueChange } = props
const { t } = useTranslation()
return <div className='space-y-2'>
<AgentStrategySelector value={strategy} onChange={onStrategyChange} />
{
strategy
? <div>
<InputVarList
readOnly={false}
nodeId={nodeId}
schema={formSchema}
<Form
formSchemas={formSchema}
value={formValue}
onChange={onFormValueChange}
validating={false}
showOnVariableMap={{}}
isEditMode={true}
fieldLabelClassName='uppercase'
/>
</div>
// TODO: list empty need a icon

View File

@ -2,14 +2,15 @@ import Button from '@/app/components/base/button'
import { RiInstallLine, RiLoader2Line } from '@remixicon/react'
import type { ComponentProps } from 'react'
import classNames from '@/utils/classnames'
import { useTranslation } from 'react-i18next'
type InstallPluginButtonProps = Omit<ComponentProps<typeof Button>, 'children'>
export const InstallPluginButton = (props: InstallPluginButtonProps) => {
const { loading, className, ...rest } = props
// TODO: add i18n label
const { t } = useTranslation()
return <Button variant={'secondary'} disabled={loading} className={classNames('flex items-center', className)} {...rest}>
{loading ? 'Installing' : 'Install'}
{loading ? t('workflow.nodes.agent.pluginInstaller.install') : t('workflow.nodes.agent.pluginInstaller.installing')}
{!loading ? <RiInstallLine className='size-4 ml-1' /> : <RiLoader2Line className='size-4 ml-1 animate-spin' />}
</Button>
}

View File

@ -289,7 +289,6 @@ const AgentPanel: FC<NodePanelProps<AgentNodeType>> = (props) => {
...inputs,
agent_parameters: value,
})}
nodeId={props.id}
/>
</Field>
<Field title={'tools'} className='px-4'>

View File

@ -703,6 +703,13 @@ const translation = {
configureTipDesc: 'After configuring the agentic strategy, this node will automatically load the remaining configurations. The strategy will affect the mechanism of multi-step tool reasoning. ',
},
learnMore: 'Learn more',
pluginNotInstalled: 'This plugin is not installed',
pluginNotInstalledDesc: 'This plugin is installed from GitHub. Please go to Plugins to reinstall',
linkToPlugin: 'Link to Plugins',
pluginInstaller: {
install: 'Install',
installing: 'Installing',
},
},
},
tracing: {

View File

@ -703,6 +703,13 @@ const translation = {
configureTipDesc: '配置完成后,此节点将自动加载剩余配置。策略将影响多步工具推理的机制。',
},
learnMore: '了解更多',
pluginNotInstalled: '插件未安装',
pluginNotInstalledDesc: '此插件是从 GitHub 安装的。请转到插件重新安装',
linkToPlugin: '转到插件',
pluginInstaller: {
install: '安装',
installing: '安装中',
},
},
},
tracing: {