Compare commits

...

6 Commits

Author SHA1 Message Date
abhi1992002
e1ace3dfb3 fix format 2026-01-19 12:32:15 +05:30
abhi1992002
47a6093619 refactor(frontend): update import paths for CredentialsGroupedView
### Summary
This commit refactors the import paths for the `CredentialsGroupedView` component across multiple files to ensure consistency and correct referencing.

### Key Changes
- Updated import statements in `RunInputDialog.tsx` and `ModalRunSection.tsx` to point to the correct file path for `CredentialsGroupedView`.
- Removed the now obsolete index file for `CredentialsGroupedView`.

### Benefits
- **Improved Code Clarity**: Ensures that the component is imported from the correct location, reducing potential errors.
- **Streamlined Imports**: Consolidates the import structure for better maintainability.

### Testing
- Verified that the components render correctly with the updated import paths and that no functionality was broken by these changes.
2026-01-19 12:29:35 +05:30
abhi1992002
cb964eed25 fix(frontend): update mock feature flags to disable new flow editor and builder view switch
### Summary
This commit modifies the mock feature flags in `use-get-flag.ts` to set both `NEW_FLOW_EDITOR` and `BUILDER_VIEW_SWITCH` to false.

### Key Changes
- Updated `mockFlags` to disable `NEW_FLOW_EDITOR` and `BUILDER_VIEW_SWITCH`.

### Benefits
- Ensures that these features are not enabled by default during development and testing.

### Testing
- Verified that the changes do not affect existing functionality and that the flags are correctly set to false.
2026-01-19 12:06:11 +05:30
abhi1992002
bf5af517ec refactor(frontend): enhance NodeOutput component with accordion UI and cleanup logic
### Summary
This commit refactors the `NodeOutput` component to improve its user interface and streamline the handling of source names.

### Key Changes
1. **Accordion Integration**: Replaced the previous expandable section with an accordion layout for better organization of node output data.
2. **Source Name Cleanup**: Introduced utility functions to clean up source names, ensuring consistency in how tool source names are displayed.
3. **Code Simplification**: Removed unnecessary state management for expansion, simplifying the component's logic.

### Benefits
- **Improved User Experience**: The accordion layout enhances readability and interaction with node output data.
- **Cleaner Code**: The refactor reduces complexity and improves maintainability of the `NodeOutput` component.

### Testing
- Verified that the accordion functionality works as intended and that source names are displayed correctly without regressions in the node output display.
2026-01-19 11:59:13 +05:30
abhi1992002
0bc877fec4 refactor(frontend): synchronize hardcoded values with handle IDs in useFlow
### Summary
This commit refactors the `useFlow` hook to ensure that hardcoded values remain in sync with handle IDs when custom nodes are present.

### Key Changes
1. **Moved Sync Logic**: The logic to synchronize hardcoded values with handle IDs has been moved into a new `useEffect` that triggers when both `customNodes` and `graph.links` are available.
2. **Removed Redundant Code**: The previous inline synchronization logic has been removed to streamline the code and improve readability.

### Benefits
- **Improved Code Clarity**: The separation of concerns enhances the maintainability of the `useFlow` hook.
- **Consistent State Management**: Ensures that hardcoded values are consistently updated based on the current state of custom nodes and graph links.

### Testing
- Verified that the synchronization logic works as intended without introducing regressions in the flow editor functionality.
2026-01-19 11:27:54 +05:30
abhi1992002
801ead850a feat(frontend): enhance RunInputDialog with CredentialsGroupedView integration
### Summary
This commit refactors the `RunInputDialog` component to utilize the new `CredentialsGroupedView` for improved credential management.

### Key Changes
1. **Integration of `CredentialsGroupedView`**: Replaces the previous credential handling logic with a more structured view that displays credential fields and manages their state.
2. **Updated State Management**: Introduces new handlers for credential field changes and updates the way credentials are processed within the dialog.
3. **Removed Legacy Code**: Cleans up unused credential schema handling and related UI components, streamlining the codebase.

### Benefits
- **Improved User Experience**: The new layout provides a clearer and more organized way to manage credentials.
- **Enhanced Code Maintainability**: By consolidating credential handling into a dedicated component, the code is easier to maintain and extend in the future.

### Testing
- Verified that the `RunInputDialog` correctly displays and manages credentials using the new `CredentialsGroupedView`.
- Ensured that all existing functionality remains intact and that no regressions were introduced.
2026-01-19 11:23:04 +05:30
9 changed files with 194 additions and 184 deletions

View File

@@ -10,6 +10,7 @@ import { useRunInputDialog } from "./useRunInputDialog";
import { CronSchedulerDialog } from "../CronSchedulerDialog/CronSchedulerDialog";
import { useTutorialStore } from "@/app/(platform)/build/stores/tutorialStore";
import { useEffect } from "react";
import { CredentialsGroupedView } from "@/components/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView";
export const RunInputDialog = ({
isOpen,
@@ -23,19 +24,17 @@ export const RunInputDialog = ({
const hasInputs = useGraphStore((state) => state.hasInputs);
const hasCredentials = useGraphStore((state) => state.hasCredentials);
const inputSchema = useGraphStore((state) => state.inputSchema);
const credentialsSchema = useGraphStore(
(state) => state.credentialsInputSchema,
);
const {
credentialsUiSchema,
credentialFields,
requiredCredentials,
handleManualRun,
handleInputChange,
openCronSchedulerDialog,
setOpenCronSchedulerDialog,
inputValues,
credentialValues,
handleCredentialChange,
handleCredentialFieldChange,
isExecutingGraph,
} = useRunInputDialog({ setIsOpen });
@@ -67,7 +66,7 @@ export const RunInputDialog = ({
<Dialog.Content>
<div className="space-y-6 p-1" data-id="run-input-dialog-content">
{/* Credentials Section */}
{hasCredentials() && (
{hasCredentials() && credentialFields.length > 0 && (
<div data-id="run-input-credentials-section">
<div className="mb-4">
<Text variant="h4" className="text-gray-900">
@@ -75,16 +74,12 @@ export const RunInputDialog = ({
</Text>
</div>
<div className="px-2" data-id="run-input-credentials-form">
<FormRenderer
jsonSchema={credentialsSchema as RJSFSchema}
handleChange={(v) => handleCredentialChange(v.formData)}
uiSchema={credentialsUiSchema}
initialValues={{}}
formContext={{
showHandles: false,
size: "large",
showOptionalToggle: false,
}}
<CredentialsGroupedView
credentialFields={credentialFields}
requiredCredentials={requiredCredentials}
inputCredentials={credentialValues}
inputValues={inputValues}
onCredentialChange={handleCredentialFieldChange}
/>
</div>
</div>

View File

@@ -7,12 +7,11 @@ import {
GraphExecutionMeta,
} from "@/lib/autogpt-server-api";
import { parseAsInteger, parseAsString, useQueryStates } from "nuqs";
import { useMemo, useState } from "react";
import { uiSchema } from "../../../FlowEditor/nodes/uiSchema";
import { isCredentialFieldSchema } from "@/components/renderers/InputRenderer/custom/CredentialField/helpers";
import { useCallback, useMemo, useState } from "react";
import { useNodeStore } from "@/app/(platform)/build/stores/nodeStore";
import { useToast } from "@/components/molecules/Toast/use-toast";
import { useReactFlow } from "@xyflow/react";
import type { CredentialField } from "@/components/contextual/CredentialsInput/components/CredentialsGroupedView/helpers";
export const useRunInputDialog = ({
setIsOpen,
@@ -120,27 +119,32 @@ export const useRunInputDialog = ({
},
});
// We are rendering the credentials field differently compared to other fields.
// In the node, we have the field name as "credential" - so our library catches it and renders it differently.
// But here we have a different name, something like `Firecrawl credentials`, so here we are telling the library that this field is a credential field type.
// Convert credentials schema to credential fields array for CredentialsGroupedView
const credentialFields: CredentialField[] = useMemo(() => {
if (!credentialsSchema?.properties) return [];
return Object.entries(credentialsSchema.properties);
}, [credentialsSchema]);
const credentialsUiSchema = useMemo(() => {
const dynamicUiSchema: any = { ...uiSchema };
// Get required credentials as a Set
const requiredCredentials = useMemo(() => {
return new Set<string>(credentialsSchema?.required || []);
}, [credentialsSchema]);
if (credentialsSchema?.properties) {
Object.keys(credentialsSchema.properties).forEach((fieldName) => {
const fieldSchema = credentialsSchema.properties[fieldName];
if (isCredentialFieldSchema(fieldSchema)) {
dynamicUiSchema[fieldName] = {
...dynamicUiSchema[fieldName],
"ui:field": "custom/credential_field",
};
// Handler for individual credential changes
const handleCredentialFieldChange = useCallback(
(key: string, value?: CredentialsMetaInput) => {
setCredentialValues((prev) => {
if (value) {
return { ...prev, [key]: value };
} else {
const next = { ...prev };
delete next[key];
return next;
}
});
}
return dynamicUiSchema;
}, [credentialsSchema]);
},
[],
);
const handleManualRun = async () => {
// Filter out incomplete credentials (those without a valid id)
@@ -173,12 +177,14 @@ export const useRunInputDialog = ({
};
return {
credentialsUiSchema,
credentialFields,
requiredCredentials,
inputValues,
credentialValues,
isExecutingGraph,
handleInputChange,
handleCredentialChange,
handleCredentialFieldChange,
handleManualRun,
openCronSchedulerDialog,
setOpenCronSchedulerDialog,

View File

@@ -139,14 +139,6 @@ export const useFlow = () => {
useNodeStore.getState().setNodes([]);
useNodeStore.getState().clearResolutionState();
addNodes(customNodes);
// Sync hardcoded values with handle IDs.
// If a keyvalue field has a key without a value, the backend omits it from hardcoded values.
// But if a handleId exists for that key, it causes inconsistency.
// This ensures hardcoded values stay in sync with handle IDs.
customNodes.forEach((node) => {
useNodeStore.getState().syncHardcodedValuesWithHandleIds(node.id);
});
}
}, [customNodes, addNodes]);
@@ -158,6 +150,14 @@ export const useFlow = () => {
}
}, [graph?.links, addLinks]);
useEffect(() => {
if (customNodes.length > 0 && graph?.links) {
customNodes.forEach((node) => {
useNodeStore.getState().syncHardcodedValuesWithHandleIds(node.id);
});
}
}, [customNodes, graph?.links]);
// update node execution status in nodes
useEffect(() => {
if (

View File

@@ -1,22 +1,21 @@
import { Button } from "@/components/atoms/Button/Button";
import { Text } from "@/components/atoms/Text/Text";
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/molecules/Accordion/Accordion";
import { beautifyString, cn } from "@/lib/utils";
import { CaretDownIcon, CopyIcon, CheckIcon } from "@phosphor-icons/react";
import { CopyIcon, CheckIcon } from "@phosphor-icons/react";
import { NodeDataViewer } from "./components/NodeDataViewer/NodeDataViewer";
import { ContentRenderer } from "./components/ContentRenderer";
import { useNodeOutput } from "./useNodeOutput";
import { ViewMoreData } from "./components/ViewMoreData";
export const NodeDataRenderer = ({ nodeId }: { nodeId: string }) => {
const {
outputData,
isExpanded,
setIsExpanded,
copiedKey,
handleCopy,
executionResultId,
inputData,
} = useNodeOutput(nodeId);
const { outputData, copiedKey, handleCopy, executionResultId, inputData } =
useNodeOutput(nodeId);
if (Object.keys(outputData).length === 0) {
return null;
@@ -25,122 +24,117 @@ export const NodeDataRenderer = ({ nodeId }: { nodeId: string }) => {
return (
<div
data-tutorial-id={`node-output`}
className="flex flex-col gap-3 rounded-b-xl border-t border-zinc-200 px-4 py-4"
className="rounded-b-xl border-t border-zinc-200 px-4 py-2"
>
<div className="flex items-center justify-between">
<Text variant="body-medium" className="!font-semibold text-slate-700">
Node Output
</Text>
<Button
variant="ghost"
size="small"
onClick={() => setIsExpanded(!isExpanded)}
className="h-fit min-w-0 p-1 text-slate-600 hover:text-slate-900"
>
<CaretDownIcon
size={16}
weight="bold"
className={`transition-transform ${isExpanded ? "rotate-180" : ""}`}
/>
</Button>
</div>
<Accordion type="single" collapsible defaultValue="node-output">
<AccordionItem value="node-output" className="border-none">
<AccordionTrigger className="py-2 hover:no-underline">
<Text
variant="body-medium"
className="!font-semibold text-slate-700"
>
Node Output
</Text>
</AccordionTrigger>
<AccordionContent className="pt-2">
<div className="flex max-w-[350px] flex-col gap-4">
<div className="space-y-2">
<Text variant="small-medium">Input</Text>
{isExpanded && (
<>
<div className="flex max-w-[350px] flex-col gap-4">
<div className="space-y-2">
<Text variant="small-medium">Input</Text>
<ContentRenderer value={inputData} shortContent={false} />
<ContentRenderer value={inputData} shortContent={false} />
<div className="mt-1 flex justify-end gap-1">
<NodeDataViewer
data={inputData}
pinName="Input"
execId={executionResultId}
/>
<Button
variant="secondary"
size="small"
onClick={() => handleCopy("input", inputData)}
className={cn(
"h-fit min-w-0 gap-1.5 border border-zinc-200 p-2 text-black hover:text-slate-900",
copiedKey === "input" &&
"border-green-400 bg-green-100 hover:border-green-400 hover:bg-green-200",
)}
>
{copiedKey === "input" ? (
<CheckIcon size={12} className="text-green-600" />
) : (
<CopyIcon size={12} />
)}
</Button>
<div className="mt-1 flex justify-end gap-1">
<NodeDataViewer
data={inputData}
pinName="Input"
execId={executionResultId}
/>
<Button
variant="secondary"
size="small"
onClick={() => handleCopy("input", inputData)}
className={cn(
"h-fit min-w-0 gap-1.5 border border-zinc-200 p-2 text-black hover:text-slate-900",
copiedKey === "input" &&
"border-green-400 bg-green-100 hover:border-green-400 hover:bg-green-200",
)}
>
{copiedKey === "input" ? (
<CheckIcon size={12} className="text-green-600" />
) : (
<CopyIcon size={12} />
)}
</Button>
</div>
</div>
</div>
{Object.entries(outputData)
.slice(0, 2)
.map(([key, value]) => (
<div key={key} className="flex flex-col gap-2">
<div className="flex items-center gap-2">
<Text
variant="small-medium"
className="!font-semibold text-slate-600"
>
Pin:
</Text>
<Text variant="small" className="text-slate-700">
{beautifyString(key)}
</Text>
</div>
<div className="w-full space-y-2">
<Text
variant="small"
className="!font-semibold text-slate-600"
>
Data:
</Text>
<div className="relative space-y-2">
{value.map((item, index) => (
<div key={index}>
<ContentRenderer value={item} shortContent={true} />
{Object.entries(outputData)
.slice(0, 2)
.map(([key, value]) => (
<div key={key} className="flex flex-col gap-2">
<div className="flex items-center gap-2">
<Text
variant="small-medium"
className="!font-semibold text-slate-600"
>
Pin:
</Text>
<Text variant="small" className="text-slate-700">
{beautifyString(key)}
</Text>
</div>
<div className="w-full space-y-2">
<Text
variant="small"
className="!font-semibold text-slate-600"
>
Data:
</Text>
<div className="relative space-y-2">
{value.map((item, index) => (
<div key={index}>
<ContentRenderer value={item} shortContent={true} />
</div>
))}
<div className="mt-1 flex justify-end gap-1">
<NodeDataViewer
data={value}
pinName={key}
execId={executionResultId}
/>
<Button
variant="secondary"
size="small"
onClick={() => handleCopy(key, value)}
className={cn(
"h-fit min-w-0 gap-1.5 border border-zinc-200 p-2 text-black hover:text-slate-900",
copiedKey === key &&
"border-green-400 bg-green-100 hover:border-green-400 hover:bg-green-200",
)}
>
{copiedKey === key ? (
<CheckIcon size={12} className="text-green-600" />
) : (
<CopyIcon size={12} />
)}
</Button>
</div>
))}
<div className="mt-1 flex justify-end gap-1">
<NodeDataViewer
data={value}
pinName={key}
execId={executionResultId}
/>
<Button
variant="secondary"
size="small"
onClick={() => handleCopy(key, value)}
className={cn(
"h-fit min-w-0 gap-1.5 border border-zinc-200 p-2 text-black hover:text-slate-900",
copiedKey === key &&
"border-green-400 bg-green-100 hover:border-green-400 hover:bg-green-200",
)}
>
{copiedKey === key ? (
<CheckIcon size={12} className="text-green-600" />
) : (
<CopyIcon size={12} />
)}
</Button>
</div>
</div>
</div>
</div>
))}
</div>
))}
</div>
{Object.keys(outputData).length > 2 && (
<ViewMoreData outputData={outputData} execId={executionResultId} />
)}
</>
)}
{Object.keys(outputData).length > 2 && (
<ViewMoreData
outputData={outputData}
execId={executionResultId}
/>
)}
</AccordionContent>
</AccordionItem>
</Accordion>
</div>
);
};

View File

@@ -4,7 +4,6 @@ import { useShallow } from "zustand/react/shallow";
import { useState } from "react";
export const useNodeOutput = (nodeId: string) => {
const [isExpanded, setIsExpanded] = useState(true);
const [copiedKey, setCopiedKey] = useState<string | null>(null);
const { toast } = useToast();
@@ -37,13 +36,10 @@ export const useNodeOutput = (nodeId: string) => {
}
};
return {
outputData: outputData,
inputData: inputData,
isExpanded: isExpanded,
setIsExpanded: setIsExpanded,
copiedKey: copiedKey,
setCopiedKey: setCopiedKey,
handleCopy: handleCopy,
outputData,
inputData,
copiedKey,
handleCopy,
executionResultId: nodeExecutionResult?.node_exec_id,
};
};

View File

@@ -61,12 +61,18 @@ export const convertNodesPlusBlockInfoIntoCustomNodes = (
return customNode;
};
const isToolSourceName = (sourceName: string): boolean =>
sourceName.startsWith("tools_^_");
const cleanupSourceName = (sourceName: string): string =>
isToolSourceName(sourceName) ? "tools" : sourceName;
export const linkToCustomEdge = (link: Link): CustomEdge => ({
id: link.id ?? "",
type: "custom" as const,
source: link.source_id,
target: link.sink_id,
sourceHandle: link.source_name,
sourceHandle: cleanupSourceName(link.source_name),
targetHandle: link.sink_name,
data: {
isStatic: link.is_static,

View File

@@ -1,9 +1,9 @@
import { Input } from "@/components/atoms/Input/Input";
import { CredentialsGroupedView } from "@/components/contextual/CredentialsInput/components/CredentialsGroupedView/CredentialsGroupedView";
import { InformationTooltip } from "@/components/molecules/InformationTooltip/InformationTooltip";
import { useMemo } from "react";
import { RunAgentInputs } from "../../../RunAgentInputs/RunAgentInputs";
import { useRunAgentModalContext } from "../../context";
import { CredentialsGroupedView } from "../CredentialsGroupedView/CredentialsGroupedView";
import { ModalSection } from "../ModalSection/ModalSection";
import { WebhookTriggerBanner } from "../WebhookTriggerBanner/WebhookTriggerBanner";
@@ -19,6 +19,8 @@ export function ModalRunSection() {
setInputValue,
agentInputFields,
agentCredentialsInputFields,
inputCredentials,
setInputCredentialsValue,
} = useRunAgentModalContext();
const inputFields = Object.entries(agentInputFields || {});
@@ -102,6 +104,9 @@ export function ModalRunSection() {
<CredentialsGroupedView
credentialFields={credentialFields}
requiredCredentials={requiredCredentials}
inputCredentials={inputCredentials}
inputValues={inputValues}
onCredentialChange={setInputCredentialsValue}
/>
</ModalSection>
) : null}

View File

@@ -5,30 +5,37 @@ import {
AccordionItem,
AccordionTrigger,
} from "@/components/molecules/Accordion/Accordion";
import {
CredentialsMetaInput,
CredentialsType,
} from "@/lib/autogpt-server-api/types";
import { CredentialsProvidersContext } from "@/providers/agent-credentials/credentials-provider";
import { SlidersHorizontal } from "@phosphor-icons/react";
import { SlidersHorizontalIcon } from "@phosphor-icons/react";
import { useContext, useEffect, useMemo, useRef } from "react";
import { useRunAgentModalContext } from "../../context";
import {
areSystemCredentialProvidersLoading,
CredentialField,
findSavedCredentialByProviderAndType,
hasMissingRequiredSystemCredentials,
splitCredentialFieldsBySystem,
} from "../helpers";
} from "./helpers";
type Props = {
credentialFields: CredentialField[];
requiredCredentials: Set<string>;
inputCredentials: Record<string, CredentialsMetaInput | undefined>;
inputValues: Record<string, any>;
onCredentialChange: (key: string, value?: CredentialsMetaInput) => void;
};
export function CredentialsGroupedView({
credentialFields,
requiredCredentials,
inputCredentials,
inputValues,
onCredentialChange,
}: Props) {
const allProviders = useContext(CredentialsProvidersContext);
const { inputCredentials, setInputCredentialsValue, inputValues } =
useRunAgentModalContext();
const { userCredentialFields, systemCredentialFields } = useMemo(
() =>
@@ -87,11 +94,11 @@ export function CredentialsGroupedView({
);
if (savedCredential) {
setInputCredentialsValue(key, {
onCredentialChange(key, {
id: savedCredential.id,
provider: savedCredential.provider,
type: savedCredential.type,
title: (savedCredential as { title?: string }).title,
type: savedCredential.type as CredentialsType,
title: savedCredential.title,
});
}
}
@@ -103,7 +110,7 @@ export function CredentialsGroupedView({
systemCredentialFields,
requiredCredentials,
inputCredentials,
setInputCredentialsValue,
onCredentialChange,
isLoadingProviders,
]);
@@ -123,7 +130,7 @@ export function CredentialsGroupedView({
}
selectedCredentials={selectedCred}
onSelectCredentials={(value) => {
setInputCredentialsValue(key, value);
onCredentialChange(key, value);
}}
siblingInputs={inputValues}
isOptional={!requiredCredentials.has(key)}
@@ -143,7 +150,8 @@ export function CredentialsGroupedView({
<AccordionItem value="system-credentials" className="border-none">
<AccordionTrigger className="py-2 text-sm text-muted-foreground hover:no-underline">
<div className="flex items-center gap-1">
<SlidersHorizontal size={16} weight="bold" /> System credentials
<SlidersHorizontalIcon size={16} weight="bold" /> System
credentials
{hasMissingSystemCredentials && (
<span className="text-destructive">(missing)</span>
)}
@@ -163,7 +171,7 @@ export function CredentialsGroupedView({
}
selectedCredentials={selectedCred}
onSelectCredentials={(value) => {
setInputCredentialsValue(key, value);
onCredentialChange(key, value);
}}
siblingInputs={inputValues}
isOptional={!requiredCredentials.has(key)}

View File

@@ -1,5 +1,5 @@
import { CredentialsProvidersContextType } from "@/providers/agent-credentials/credentials-provider";
import { getSystemCredentials } from "../../../../../../../../../../../components/contextual/CredentialsInput/helpers";
import { getSystemCredentials } from "../../helpers";
export type CredentialField = [string, any];