feat: 优化工作流参数编辑与告警交互

- 新增 ParamTokenEditor,支持参数选择插入、token 高亮、整段删除与光标避让

- 参数候选改为动态监测,未映射参数可选择并在下拉与输入框顶部告警

- 接入知识库/搜索引擎/LLM/动态代码/HTTP Body 及 SQL、查询数据自定义节点

- 优化 Http 节点布局并补充参数解析工具与单测
This commit is contained in:
2026-02-28 21:37:49 +08:00
parent 59c95a3b06
commit 4ef17da6f4
13 changed files with 1465 additions and 120 deletions

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import NodeWrapper from '../core/NodeWrapper.svelte';
import {type NodeProps, useSvelteFlow} from '@xyflow/svelte';
import {Button, Heading, Input, Select} from '../base';
import {type NodeProps, useNodesData, useSvelteFlow} from '@xyflow/svelte';
import {Button, Heading, Select} from '../base';
import RefParameterList from '../core/RefParameterList.svelte';
import {getCurrentNodeId} from '#components/utils/NodeUtils';
import {useAddParameter} from '../utils/useAddParameter.svelte';
@@ -9,6 +9,7 @@
import {onMount} from 'svelte';
import OutputDefList from '../core/OutputDefList.svelte';
import type {SelectItem} from '#types';
import ParamTokenEditor from '../core/ParamTokenEditor.svelte';
const { data, ...rest }: {
data: NodeProps['data'],
@@ -16,7 +17,11 @@
} = $props();
const currentNodeId = getCurrentNodeId();
let currentNode = useNodesData(currentNodeId);
const { addParameter } = useAddParameter();
const editorParameters = $derived.by(() => {
return (currentNode?.current?.data?.parameters as Array<any>) || data.parameters || [];
});
const options = getOptions();
@@ -99,9 +104,13 @@
<div class="setting-title">关键字</div>
<div class="setting-item">
<Input placeholder="请输入关键字" style="width: 100%"
value={data.keyword}
onchange={(e)=>{
<ParamTokenEditor
mode="input"
placeholder="请输入关键字"
style="width: 100%"
parameters={editorParameters}
value={data.keyword || ''}
oninput={(e)=>{
const newValue = e.target.value;
updateNodeData(currentNodeId, ()=>{
return {
@@ -114,15 +123,21 @@
<div class="setting-title">搜索数据量</div>
<div class="setting-item">
<Input placeholder="搜索的数据条数" style="width: 100%" value={data.limit}
onchange={(e)=>{
<ParamTokenEditor
mode="input"
placeholder="搜索的数据条数"
style="width: 100%"
value={data.limit || ''}
parameters={editorParameters}
oninput={(e)=>{
const newValue = e.target.value;
updateNodeData(currentNodeId, ()=>{
return {
limit: newValue
}
})
}} />
}}
/>
</div>
@@ -156,5 +171,3 @@
</style>