feat(web): 增加任务和流程图CRUD
This commit is contained in:
51
service-web/client/src/components/flow/node/LlmNode.tsx
Normal file
51
service-web/client/src/components/flow/node/LlmNode.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import type {NodeProps} from '@xyflow/react'
|
||||
import {Tag} from 'antd'
|
||||
import AmisNode, {inputsFormColumns, outputsFormColumns} from './AmisNode.tsx'
|
||||
import React from 'react'
|
||||
|
||||
const modelMap: Record<string, string> = {
|
||||
qwen3: 'Qwen3',
|
||||
deepseek: 'Deepseek',
|
||||
}
|
||||
|
||||
const LlmNode = (props: NodeProps) => AmisNode({
|
||||
nodeProps: props,
|
||||
type: 'normal',
|
||||
defaultNodeName: '大模型',
|
||||
defaultNodeDescription: '使用大模型对话',
|
||||
extraNodeDescription: nodeData => {
|
||||
const model = nodeData?.model as string | undefined
|
||||
return model
|
||||
? <div className="mt-2 flex justify-between">
|
||||
<span>大模型</span>
|
||||
<Tag className="m-0" color="blue">{modelMap[model]}</Tag>
|
||||
</div>
|
||||
: <></>
|
||||
},
|
||||
columnSchema: [
|
||||
...inputsFormColumns(),
|
||||
{
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
name: 'model',
|
||||
label: '大模型',
|
||||
required: true,
|
||||
selectFirst: true,
|
||||
options: Object.keys(modelMap).map(key => ({label: modelMap[key], value: key})),
|
||||
},
|
||||
{
|
||||
type: 'textarea',
|
||||
name: 'systemPrompt',
|
||||
label: '系统提示词',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
type: 'divider',
|
||||
},
|
||||
...outputsFormColumns(false, true, {text: {type: 'string'}}),
|
||||
],
|
||||
})
|
||||
|
||||
export default React.memo(LlmNode)
|
||||
Reference in New Issue
Block a user