Merge pull request #701 from SuanmoSuanyangTechnology/feature/ui_upgrade_zy

Feature/UI upgrade zy
This commit is contained in:
yingzhao
2026-03-26 18:49:52 +08:00
committed by GitHub
8 changed files with 48 additions and 135 deletions

View File

@@ -2163,6 +2163,7 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re
'memory-write': 'Memory Storage',
unknown: 'Unknown Node',
notes: 'Sticky Note',
'document-extractor': 'Document Extractor',
clickToConfigure: 'Click to configure node parameters',
nodeProperties: 'Node Properties',
@@ -2361,6 +2362,9 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re
placeholder: 'Enter note...',
removeLink: 'Remove Link',
},
'document-extractor': {
file_selector: 'Input Variable',
},
name: 'Key',
type: 'Type',
value: 'Value',

View File

@@ -2160,6 +2160,7 @@ export const zh = {
'memory-write': '记忆储存',
unknown: '未知节点',
notes: '便签',
'document-extractor': '文档提取器',
clickToConfigure: '点击配置节点参数',
nodeProperties: '节点属性',
@@ -2361,6 +2362,9 @@ export const zh = {
placeholder: '输入注释...',
removeLink: '取消链接',
},
'document-extractor': {
file_selector: '输入变量',
},
name: '键',
type: '类型',
value: '值',

View File

@@ -161,10 +161,12 @@ const Neo4j: FC = () => {
<RelationshipNetwork />
</Flex>
</Flex>
<EndUserProfile ref={ref} onDataLoaded={handleNameUpdate} className={selectedKey === 'userProfile' ? 'rb:block!' : 'rb:hidden!'} />
<AboutMe ref={aboutMeRef} className={selectedKey === 'aboutMe' ? 'rb:block!' : 'rb:hidden!'} />
<InterestDistribution className={selectedKey === 'interestDistribution' ? 'rb:block!' : 'rb:hidden!'} />
<MemoryInsight ref={memoryInsightRef} className={selectedKey === 'memoryInsight' ? 'rb:block!' : 'rb:hidden!'} />
<div onClick={(e) => e.stopPropagation()}>
<EndUserProfile ref={ref} onDataLoaded={handleNameUpdate} className={selectedKey === 'userProfile' ? 'rb:block!' : 'rb:hidden!'} />
<AboutMe ref={aboutMeRef} className={selectedKey === 'aboutMe' ? 'rb:block!' : 'rb:hidden!'} />
<InterestDistribution className={selectedKey === 'interestDistribution' ? 'rb:block!' : 'rb:hidden!'} />
<MemoryInsight ref={memoryInsightRef} className={selectedKey === 'memoryInsight' ? 'rb:block!' : 'rb:hidden!'} />
</div>
</div>
)
}

View File

@@ -53,7 +53,7 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, options
const root = $getRoot();
root.clear();
const parts = value.split(/(\{\{[^}]+\}\})/);
const parts = value.split(/(\{\{[^}]+\}\}|\n)/);
if (enableLineNumbers) {
const lines = value.split('\n');
@@ -63,8 +63,14 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, options
root.append(paragraph);
});
} else {
const paragraph = $createParagraphNode();
let paragraph = $createParagraphNode();
parts.forEach(part => {
if (part === '\n') {
root.append(paragraph);
paragraph = $createParagraphNode();
return;
}
const match = part.match(/^\{\{([^.]+)\.([^}]+)\}\}$/);
const contextMatch = part.match(/^\{\{context\}\}$/);
const conversationMatch = part.match(/^\{\{conv\.([^}]+)\}\}$/);
@@ -78,10 +84,10 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, options
}
return
}
if (conversationMatch) {
const [_, variableName] = conversationMatch;
const conversationSuggestion = optionsRef.current.find(s =>
const conversationSuggestion = optionsRef.current.find(s =>
s.group === 'CONVERSATION' && s.label === variableName
);
if (conversationSuggestion) {
@@ -91,7 +97,7 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, options
}
return
}
if (match) {
const [_, nodeId, label] = match;

View File

@@ -1,10 +1,11 @@
import { type FC } from 'react'
import { type FC, useMemo } from 'react'
import { useTranslation } from 'react-i18next';
import { Form, Select, Input, Button, InputNumber, Flex } from 'antd'
import VariableSelect from '../VariableSelect'
import type { Suggestion } from '../../Editor/plugin/AutocompletePlugin'
import RadioGroupBtn from '../RadioGroupBtn'
import { getChildNodeVariables } from '../hooks/useVariableList'
interface CycleVar {
name: string;
@@ -44,40 +45,14 @@ const CycleVarsList: FC<CycleVarsListProps> = ({
const { t } = useTranslation();
const form = Form.useFormInstance();
// 获取循环节点的子节点变量
const getChildNodeVariables = () => {
const availableOptions = useMemo(() => {
if (!selectedNode || !graphRef?.current || selectedNode.getData()?.type !== 'loop') {
return options;
}
const childVars = getChildNodeVariables(selectedNode, graphRef);
const loopNodeId = selectedNode.getData()?.id;
const childNodes = graphRef.current.getNodes().filter((node: any) =>
node.getData()?.cycle === loopNodeId
);
const childVariables: Suggestion[] = [];
childNodes.forEach((childNode: any) => {
const childData = childNode.getData();
if (childData?.config) {
Object.keys(childData.config).forEach(key => {
if (childData.config[key]?.defaultValue) {
childVariables.push({
key: `${childData.id}.${key}`,
label: `${childData.name || childData.type}.${key}`,
type: 'output',
dataType: 'string',
value: `${childData.id}.${key}`,
nodeData: childData
});
}
});
}
});
return [...options, ...childVariables];
};
const availableOptions = getChildNodeVariables();
return options.filter(option => !childVars.some(item => item.value === option.value))
}, [options, selectedNode, graphRef]);
return (
<Form.List name={parentName}>

View File

@@ -42,6 +42,9 @@ const NODE_VARIABLES = {
'memory-read': [
{ label: 'answer', dataType: 'string', field: 'answer' },
{ label: 'intermediate_outputs', dataType: 'array[object]', field: 'intermediate_outputs' }
],
'document-extractor': [
{ label: 'text', dataType: 'string', field: 'text' },
]
} as const;
@@ -177,7 +180,8 @@ const hasOutputNodeTypes = [
'var-aggregator',
'http-request',
'tool',
'jinja-render'
'jinja-render',
'document-extractor'
];
/**

View File

@@ -636,6 +636,8 @@ const Properties: FC<PropertiesProps> = ({
size="small"
parentName={key}
options={getFilteredVariableList(selectedNode?.data?.type, key)}
selectedNode={selectedNode}
graphRef={graphRef}
/>
</Form.Item>
)

View File

@@ -473,6 +473,16 @@ export const nodeLibrary: NodeLibrary[] = [
},
}
},
{
type: "document-extractor", icon: codeExecutionIcon,
config: {
file_selector: {
type: 'variableList',
placeholder: 'common.pleaseSelect',
onFilterVariableNames: ['sys.files']
}
}
},
]
},
];
@@ -858,100 +868,6 @@ export interface OutputVariable {
}>;
}
/**
* Output variable definitions for each node type
* Specifies what variables each node produces
*/
export const outputVariable: { [key: string]: OutputVariable } = {
start: {
sys: [
{ name: "message", type: "string" },
{ name: "conversation_id", type: "string" },
{ name: "execution_id", type: "string", },
{ name: "workspace_id", type: "string" },
{ name: "user_id", type: "string" },
],
define: ['variables']
},
end: {
},
llm: {
default: [
{ name: "output", type: "string" },
]
},
'knowledge-retrieval': {
default: [
{ name: "output", type: "array[object]" },
]
},
'parameter-extractor': {
default: [
{ name: "__is_success", type: "number" },
{ name: "__reason", type: "string" },
],
define: ['params']
},
'memory-read': {
default: [
{ name: "answer", type: "string" },
{ name: "intermediate_outputs", type: "array[object]" },
],
},
'memory-write': {
},
'if-else': {
},
'question-classifier': {
default: [
{ name: "class_name", type: "string" },
// { name: "output", type: "string" },
],
},
'iteration': {
default: [
// { name: "item", type: "string" }, // 仅内部使用
{ name: "output", type: "array[string]" },
],
},
'loop': {
define: ['cycle_vars']
},
'cycle-start': {
},
'break': {
},
'var-aggregator': {
// default: [
// { name: "output", type: "string" },
// ],
define: ['group_variables']
},
'assigner': {
},
'http-request': {
default: [
{ name: "body", type: "string" },
{ name: "status_code", type: "number" },
],
},
'tool': {
default: [
{ name: "data", type: "string" },
],
},
'jinja-render': {
default: [
{ name: "output", type: "string" },
],
},
}
/**
* Default edge attributes configuration
* Defines visual styling for edges/connections