Fix conditional statement in IOView component

This commit is contained in:
anovazzi1 2024-02-08 17:34:24 -03:00
commit 34b3be397e

View file

@ -28,7 +28,10 @@ export default function IOView(): JSX.Element {
}>(handleInitialView()); }>(handleInitialView());
function handleInitialView() { function handleInitialView() {
if (outputs.map((output) => output.type).includes("ChatOutput")) { if (
outputs.map((output) => output.type).includes("ChatOutput") ||
inputs.map((input) => input.type).includes("ChatInput")
) {
return { type: "ChatOutput" }; return { type: "ChatOutput" };
} }
return { type: "" }; return { type: "" };
@ -83,7 +86,8 @@ export default function IOView(): JSX.Element {
</button> </button>
); );
})} })}
{outputs.map((output) => output.type).includes("ChatOutput") && {(outputs.map((output) => output.type).includes("ChatOutput") ||
inputs.map((output) => output.type).includes("chatInput")) &&
selectedView.type !== "ChatOutput" && ( selectedView.type !== "ChatOutput" && (
<button <button
onClick={() => setSelectedView({ type: "ChatOutput" })} onClick={() => setSelectedView({ type: "ChatOutput" })}