Feat: Construct a dynamic variable assignment form #10427 (#11316)

### What problem does this PR solve?

Feat: Construct a dynamic variable assignment form #10427

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2025-11-17 19:45:58 +08:00
committed by GitHub
parent 7264fb6978
commit d8f413a885
14 changed files with 1275 additions and 313 deletions

View File

@ -7,8 +7,11 @@ import {
} from '../constant';
import useGraphStore from '../store';
function splitValue(value?: string) {
return typeof value === 'string' ? value?.split('@') : [];
}
function getNodeId(value: string) {
return value.split('@').at(0);
return splitValue(value).at(0);
}
export function useShowSecondaryMenu() {
@ -63,7 +66,7 @@ export function useFindAgentStructuredOutputLabel() {
}>,
) => {
// agent structured output
const fields = value.split('@');
const fields = splitValue(value);
if (
getOperatorTypeFromId(fields.at(0)) === Operator.Agent &&
fields.at(1)?.startsWith(AgentStructuredOutputField)
@ -130,7 +133,7 @@ export function useFindAgentStructuredOutputTypeByValue() {
if (!value) {
return;
}
const fields = value.split('@');
const fields = splitValue(value);
const nodeId = fields.at(0);
const jsonSchema = filterStructuredOutput(value);
@ -163,7 +166,7 @@ export function useFindAgentStructuredOutputLabelByValue() {
const operatorName = getNode(getNodeId(value ?? ''))?.data.name;
if (operatorName) {
return operatorName + ' / ' + value?.split('@').at(1);
return operatorName + ' / ' + splitValue(value).at(1);
}
}