Compare commits

...

1 Commits

Author SHA1 Message Date
Lluis Agusti
6512d4a386 chore: agent input 2025-12-11 22:37:14 +07:00
2 changed files with 22 additions and 16 deletions

View File

@@ -6,11 +6,8 @@ import type {
CredentialsMetaInput, CredentialsMetaInput,
} from "@/lib/autogpt-server-api/types"; } from "@/lib/autogpt-server-api/types";
import { CredentialsInput } from "../CredentialsInputs/CredentialsInputs"; import { CredentialsInput } from "../CredentialsInputs/CredentialsInputs";
import { import { RunAgentInputs } from "../RunAgentInputs/RunAgentInputs";
getAgentCredentialsFields, import { getAgentCredentialsFields, getAgentInputFields } from "./helpers";
getAgentInputFields,
renderValue,
} from "./helpers";
type Props = { type Props = {
agent: LibraryAgent; agent: LibraryAgent;
@@ -48,16 +45,18 @@ export function AgentInputsReadOnly({
{/* Regular inputs */} {/* Regular inputs */}
{hasInputs && ( {hasInputs && (
<div className="flex flex-col gap-4"> <div className="flex flex-col gap-4">
{inputEntries.map(([key, [schema, value]]) => ( {inputEntries.map(([key, [schema, value]]) => {
<div key={key} className="flex flex-col gap-1.5"> if (!schema) return null;
<label className="text-sm font-medium"> return (
{schema?.title || key} <RunAgentInputs
</label> key={key}
<p className="whitespace-pre-wrap break-words text-sm text-neutral-700"> schema={schema}
{renderValue(value)} value={value}
</p> onChange={() => {}}
</div> readOnly={true}
))} />
);
})}
</div> </div>
)} )}

View File

@@ -32,6 +32,7 @@ interface Props {
value?: any; value?: any;
placeholder?: string; placeholder?: string;
onChange: (value: any) => void; onChange: (value: any) => void;
readOnly?: boolean;
} }
/** /**
@@ -44,6 +45,7 @@ export function RunAgentInputs({
value, value,
placeholder, placeholder,
onChange, onChange,
readOnly,
...props ...props
}: Props & React.HTMLAttributes<HTMLElement>) { }: Props & React.HTMLAttributes<HTMLElement>) {
const { handleUploadFile, uploadProgress } = useRunAgentInputs(); const { handleUploadFile, uploadProgress } = useRunAgentInputs();
@@ -347,6 +349,11 @@ export function RunAgentInputs({
} }
return ( return (
<div className="no-drag relative flex w-full">{innerInputElement}</div> <div
className="no-drag relative flex w-full"
style={readOnly ? { pointerEvents: "none", opacity: 0.7 } : undefined}
>
{innerInputElement}
</div>
); );
} }