chore: add i18n

pull/12372/head
AkaraChen 1 year ago
parent da6d65b072
commit a8a956b5f1

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

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

@ -2,14 +2,15 @@ import Button from '@/app/components/base/button'
import { RiInstallLine, RiLoader2Line } from '@remixicon/react' import { RiInstallLine, RiLoader2Line } from '@remixicon/react'
import type { ComponentProps } from 'react' import type { ComponentProps } from 'react'
import classNames from '@/utils/classnames' import classNames from '@/utils/classnames'
import { useTranslation } from 'react-i18next'
type InstallPluginButtonProps = Omit<ComponentProps<typeof Button>, 'children'> type InstallPluginButtonProps = Omit<ComponentProps<typeof Button>, 'children'>
export const InstallPluginButton = (props: InstallPluginButtonProps) => { export const InstallPluginButton = (props: InstallPluginButtonProps) => {
const { loading, className, ...rest } = props 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}> 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' />} {!loading ? <RiInstallLine className='size-4 ml-1' /> : <RiLoader2Line className='size-4 ml-1 animate-spin' />}
</Button> </Button>
} }

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

@ -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. ', 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', 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: { tracing: {

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

Loading…
Cancel
Save