Remove excessive label

zamilmajdy/open-1984-agentinputblock-and-agentoutputblocks-name-field-should-be
Zamil Majdy 2024-11-04 20:59:42 +07:00
parent 89d563dff0
commit 9bb81e6a23
1 changed files with 15 additions and 78 deletions

View File

@ -163,38 +163,6 @@ export function CustomNode({
if (!schema?.properties) return null;
let keys = Object.entries(schema.properties);
switch (nodeType) {
case BlockUIType.INPUT:
// For INPUT blocks, dont include connection handles
return keys.map(([propKey, propSchema]) => {
const isRequired = data.inputSchema.required?.includes(propKey);
const isConnected = isHandleConnected(propKey);
const isAdvanced = propSchema.advanced;
return (
(isRequired || isAdvancedOpen || !isAdvanced) && (
<div key={propKey} data-id={`input-handle-${propKey}`}>
<span className="text-m green mb-0 text-gray-900">
{propSchema.title || beautifyString(propKey)}
</span>
<div key={propKey}>
{!isConnected && (
<NodeGenericInputField
nodeId={id}
propKey={propKey}
propSchema={propSchema}
currentValue={getValue(propKey)}
connections={data.connections}
handleInputChange={handleInputChange}
handleInputClick={handleInputClick}
errors={data.errors ?? {}}
displayName={propSchema.title || beautifyString(propKey)}
/>
)}
</div>
</div>
)
);
});
case BlockUIType.NOTE:
// For NOTE blocks, don't render any input handles
const [noteKey, noteSchema] = keys[0];
@ -213,59 +181,22 @@ export function CustomNode({
</div>
);
case BlockUIType.OUTPUT:
// For OUTPUT blocks, only show the 'value' property
return keys.map(([propKey, propSchema]) => {
const isRequired = data.inputSchema.required?.includes(propKey);
const isConnected = isHandleConnected(propKey);
const isAdvanced = propSchema.advanced;
return (
(isRequired || isAdvancedOpen || !isAdvanced) && (
<div key={propKey} data-id={`output-handle-${propKey}`}>
{propKey !== "value" ? (
<span className="text-m green mb-0 text-gray-900">
{propSchema.title || beautifyString(propKey)}
</span>
) : (
<NodeHandle
keyName={propKey}
isConnected={isConnected}
isRequired={isRequired}
schema={propSchema}
side="left"
/>
)}
{!isConnected && (
<NodeGenericInputField
nodeId={id}
propKey={propKey}
propSchema={propSchema}
currentValue={getValue(propKey)}
connections={data.connections}
handleInputChange={handleInputChange}
handleInputClick={handleInputClick}
errors={data.errors ?? {}}
displayName={propSchema.title || beautifyString(propKey)}
/>
)}
</div>
)
);
});
default:
return keys.map(([propKey, propSchema]) => {
const isConnectable =
// No input connection handles for credentials
propKey !== "credentials" &&
// For INPUT blocks, no input connection handles.
!(nodeType == BlockUIType.INPUT) &&
// For OUTPUT blocks, only show the 'value' (hides 'name') input connection handle
!(nodeType == BlockUIType.OUTPUT && propKey == "name");
const isRequired = data.inputSchema.required?.includes(propKey);
const isConnected = isHandleConnected(propKey);
const isAdvanced = propSchema.advanced;
return (
(isRequired || isAdvancedOpen || isConnected || !isAdvanced) && (
<div key={propKey} data-id={`input-handle-${propKey}`}>
{"credentials_provider" in propSchema ? (
<span className="text-m green mb-0 text-gray-900">
Credentials
</span>
) : (
{isConnectable ? (
<NodeHandle
keyName={propKey}
isConnected={isConnected}
@ -273,8 +204,14 @@ export function CustomNode({
schema={propSchema}
side="left"
/>
) : (
<span className="text-m green mb-0 text-gray-900">
{propKey == "credentials"
? "Credentials"
: propSchema.title || beautifyString(propKey)}
</span>
)}
{!isConnected && (
{isConnected || (
<NodeGenericInputField
nodeId={id}
propKey={propKey}