fix(IOInputField): remove console.log statement for inputType variable

fix(IOview): fix conditional rendering of IOInputField and IOOutputView components based on selectedCategory
This commit is contained in:
anovazzi1 2024-01-30 18:25:09 -03:00
commit 3c58007b62
2 changed files with 32 additions and 21 deletions

View file

@ -11,6 +11,7 @@ export default function IOInputField({
const nodes = useFlowStore((state) => state.nodes);
const setNode = useFlowStore((state) => state.setNode);
const node = nodes.find((node) => node.id === inputId);
console.log(inputType);
function handleInputType() {
if (!node) return "no node found";
switch (inputType) {
@ -30,7 +31,7 @@ export default function IOInputField({
}}
/>
);
case "fileLoader":
case "FileLoader":
return (
<IOFileInput
field={node.data.node!.template["file_path"]["value"]}

View file

@ -83,23 +83,24 @@ export default function IOView(): JSX.Element {
</button>
);
})}
{selectedView.type !== "ChatOutput" && (
<button
onClick={() => setSelectedView({ type: "ChatOutput" })}
className={
"cursor flex items-center rounded-md rounded-b-none px-1 hover:bg-muted-foreground"
}
key={"chat"}
>
<IconComponent
name="Variable"
className=" file-component-variable"
/>
<span className="file-component-variables-span text-md">
Chat
</span>
</button>
)}
{outputs.map((output) => output.type).includes("ChatOutput") &&
selectedView.type !== "ChatOutput" && (
<button
onClick={() => setSelectedView({ type: "ChatOutput" })}
className={
"cursor flex items-center rounded-md rounded-b-none px-1 hover:bg-muted-foreground"
}
key={"chat"}
>
<IconComponent
name="Variable"
className=" file-component-variable"
/>
<span className="file-component-variables-span text-md">
Chat
</span>
</button>
)}
</div>
{UpdateAccordion()
.filter((input) => input.type !== "ChatInput")
@ -131,9 +132,18 @@ export default function IOView(): JSX.Element {
keyValue={input.id}
>
<div className="file-component-tab-column">
{node && (
<IOInputField inputType={input.type} inputId={input.id} />
)}
{node &&
(selectedCategory === "Inputs" ? (
<IOInputField
inputType={input.type}
inputId={input.id}
/>
) : (
<IOOutputView
outputType={input.type}
outputId={input.id}
/>
))}
</div>
</AccordionComponent>
</div>