Commit ace04b3e authored by Joel's avatar Joel

feat: filed and var

parent 1a4c2e77
'use client'
import type { FC } from 'react'
import React from 'react'
import cn from 'classnames'
import { Plus } from '../icons/src/vender/line/general'
type Props = {
className?: string
onClick: () => void
}
const AddButton: FC<Props> = ({
className,
onClick,
}) => {
return (
<div className={cn(className, 'p-1 rounded-md cursor-pointer hover:bg-gray-200 select-none')} onClick={onClick}>
<Plus className='w-4 h-4 text-gray-500' />
</div>
)
}
export default React.memo(AddButton)
'use client'
import type { FC } from 'react'
import React from 'react'
type Props = {
title: string
children: JSX.Element | string
operations?: JSX.Element
}
const Filed: FC<Props> = ({
title,
children,
operations,
}) => {
return (
<div>
<div className='flex justify-between items-center'>
<div className='leading-[18px] text-xs font-medium text-gray-500 uppercase'>{title}</div>
{operations && <div>{operations}</div>}
</div>
<div>{children}</div>
</div>
)
}
export default React.memo(Filed)
import type { FC } from 'react'
import { useTranslation } from 'react-i18next'
import BaseNode from '../_base/node'
import Field from '@/app/components/workflow/nodes/_base/components/field'
import AddButton from '@/app/components/base/button/add-button'
const i18nPrefix = 'workflow.nodes.llm'
const Node: FC = () => {
const { t } = useTranslation()
const handleAddVariable = () => {
console.log('add variable')
}
return (
<BaseNode>
<div>llm</div>
<div>
<Field
title={t(`${i18nPrefix}.model`)}
>
Model Selector
</Field>
<Field
title={t(`${i18nPrefix}.variables`)}
operations={
<AddButton onClick={handleAddVariable} />
}
>
Var Selector
</Field>
</div>
</BaseNode>
)
}
......
......@@ -61,6 +61,9 @@ import customPt from './lang/custom.pt' // Portuguese import
import toolsEn from './lang/tools.en'
import toolsZh from './lang/tools.zh'
import toolsPt from './lang/tools.pt' // Portuguese import
import workflowEn from './lang/workflow.en'
import workflowZh from './lang/workflow.zh'
import workflowPt from './lang/workflow.pt' // Portuguese import
const resources = {
'en-US': {
......@@ -89,6 +92,7 @@ const resources = {
custom: customEn,
// tools
tools: toolsEn,
workflow: workflowEn,
},
},
'zh-Hans': {
......@@ -116,6 +120,7 @@ const resources = {
custom: customZh,
// tools
tools: toolsZh,
workflow: workflowZh,
},
},
'pt-BR': {
......@@ -142,6 +147,7 @@ const resources = {
billing: billingPt,
custom: customPt,
tools: toolsPt,
workflow: workflowPt,
},
},
}
......
const translation = {
nodes: {
llm: {
model: 'model',
variables: 'variables',
},
},
}
export default translation
const translation = {
nodes: {
llm: {
model: 'model',
},
},
}
export default translation
const translation = {
nodes: {
llm: {
model: '模型',
variables: '变量',
},
},
}
export default translation
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment