Commit 36664620 authored by Joel's avatar Joel

feat: llm input struct

parent da0d9aab
...@@ -42,6 +42,7 @@ const Page: FC = () => { ...@@ -42,6 +42,7 @@ const Page: FC = () => {
<Workflow <Workflow
nodes={initialNodes} nodes={initialNodes}
edges={initialEdges} edges={initialEdges}
selectedNodeId='3'// TODO: for debug. 3: llm.
/> />
</div> </div>
) )
......
...@@ -88,6 +88,7 @@ const WorkflowWrapWithReactFlowProvider: FC<WorkflowWrapProps> = ({ ...@@ -88,6 +88,7 @@ const WorkflowWrapWithReactFlowProvider: FC<WorkflowWrapProps> = ({
}) => { }) => {
return ( return (
<ReactFlowProvider> <ReactFlowProvider>
{selectedNodeId}
<WorkflowWrap <WorkflowWrap
selectedNodeId={selectedNodeId} selectedNodeId={selectedNodeId}
nodes={nodes} nodes={nodes}
......
'use client' 'use client'
import type { FC } from 'react' import type { FC } from 'react'
import React from 'react' import React from 'react'
import cn from 'classnames'
import { HelpCircle } from '@/app/components/base/icons/src/vender/line/general'
import TooltipPlus from '@/app/components/base/tooltip-plus'
type Props = { type Props = {
title: string title: string
tooltip?: string
children: JSX.Element | string children: JSX.Element | string
operations?: JSX.Element operations?: JSX.Element
inline?: boolean
} }
const Filed: FC<Props> = ({ const Filed: FC<Props> = ({
title, title,
tooltip,
children, children,
operations, operations,
inline,
}) => { }) => {
return ( return (
<div> <div className={cn(inline && 'flex justify-between items-center')}>
<div className='flex justify-between items-center'> <div className='flex justify-between items-center'>
<div className='leading-[18px] text-xs font-medium text-gray-500 uppercase'>{title}</div> <div className='flex items-center'>
<div className=' h-[18px] text-xs font-medium text-gray-500 uppercase'>{title}</div>
{tooltip && (
<TooltipPlus popupContent='tooltip'>
<HelpCircle className='w-3.5 h-3.5 ml-0.5 text-gray-400' />
</TooltipPlus>
)}
</div>
{operations && <div>{operations}</div>} {operations && <div>{operations}</div>}
</div> </div>
<div>{children}</div> <div>{children}</div>
......
'use client'
import type { FC } from 'react'
import React from 'react'
import cn from 'classnames'
type Props = {
className?: string
}
const Split: FC<Props> = ({
className,
}) => {
return (
<div className={cn(className, 'h-px bg-black/5')}>
</div>
)
}
export default React.memo(Split)
...@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' ...@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'
import BasePanel from '../_base/panel' import BasePanel from '../_base/panel'
import Field from '@/app/components/workflow/nodes/_base/components/field' import Field from '@/app/components/workflow/nodes/_base/components/field'
import AddButton from '@/app/components/base/button/add-button' import AddButton from '@/app/components/base/button/add-button'
import Split from '@/app/components/workflow/nodes/_base/components/split'
const i18nPrefix = 'workflow.nodes.llm' const i18nPrefix = 'workflow.nodes.llm'
const Panel: FC = () => { const Panel: FC = () => {
...@@ -12,21 +13,49 @@ const Panel: FC = () => { ...@@ -12,21 +13,49 @@ const Panel: FC = () => {
} }
return ( return (
<BasePanel <BasePanel
inputsElement={<div> inputsElement={
<Field <div className='mt-2 px-4 space-y-4'>
title={t(`${i18nPrefix}.model`)} <Field
> title={t(`${i18nPrefix}.model`)}
Model Selector >
</Field> Model Selector
<Field </Field>
title={t(`${i18nPrefix}.variables`)}
operations={ <Field
<AddButton onClick={handleAddVariable} /> title={t(`${i18nPrefix}.variables`)}
} operations={
> <AddButton onClick={handleAddVariable} />
Var Selector }
</Field> >
</div>} Var Selector
</Field>
<Field
title={t(`${i18nPrefix}.context`)}
>
Context
</Field>
<Field
title={t(`${i18nPrefix}.context`)}
>
Prompt
</Field>
<Split />
<Field
title={t(`${i18nPrefix}.vision`)}
inline
>
Vision
</Field>
{/* This version not support function */}
{/* <Field
title={t(`${i18nPrefix}.fu`)}
inline
>
Functions
</Field> */}
</div>
}
outputsElement={<div>start panel outputs</div>} outputsElement={<div>start panel outputs</div>}
/> />
) )
......
...@@ -3,6 +3,9 @@ const translation = { ...@@ -3,6 +3,9 @@ const translation = {
llm: { llm: {
model: 'model', model: 'model',
variables: 'variables', variables: 'variables',
context: 'context',
prompt: 'prompt',
vision: 'vision',
}, },
}, },
} }
......
...@@ -3,6 +3,9 @@ const translation = { ...@@ -3,6 +3,9 @@ const translation = {
llm: { llm: {
model: '模型', model: '模型',
variables: '变量', variables: '变量',
context: '上下文',
prompt: '提示词',
vision: '视觉',
}, },
}, },
} }
......
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