Merge branch 'zustand/io/migration' of github.com:logspace-ai/langflow into zustand/io/migration
This commit is contained in:
commit
45d7945cd3
1 changed files with 7 additions and 4 deletions
|
|
@ -1,10 +1,8 @@
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { useNodes } from "reactflow";
|
|
||||||
import { CHAT_FORM_DIALOG_SUBTITLE } from "../../constants/constants";
|
import { CHAT_FORM_DIALOG_SUBTITLE } from "../../constants/constants";
|
||||||
import BaseModal from "../../modals/baseModal";
|
import BaseModal from "../../modals/baseModal";
|
||||||
import useFlowStore from "../../stores/flowStore";
|
import useFlowStore from "../../stores/flowStore";
|
||||||
import { ChatType } from "../../types/chat";
|
import { ChatType } from "../../types/chat";
|
||||||
import { NodeType } from "../../types/flow";
|
|
||||||
import IOView from "../IOview";
|
import IOView from "../IOview";
|
||||||
import ChatTrigger from "../ViewTriggers/chat";
|
import ChatTrigger from "../ViewTriggers/chat";
|
||||||
import IconComponent from "../genericIconComponent";
|
import IconComponent from "../genericIconComponent";
|
||||||
|
|
@ -13,9 +11,15 @@ import BuildTrigger from "./buildTrigger";
|
||||||
export default function Chat({ flow }: ChatType): JSX.Element {
|
export default function Chat({ flow }: ChatType): JSX.Element {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const flowState = useFlowStore((state) => state.flowState);
|
const flowState = useFlowStore((state) => state.flowState);
|
||||||
|
const nodes = useFlowStore((state) => state.nodes);
|
||||||
const checkInputAndOutput = useFlowStore(
|
const checkInputAndOutput = useFlowStore(
|
||||||
(state) => state.checkInputAndOutput
|
(state) => state.checkInputAndOutput
|
||||||
);
|
);
|
||||||
|
const [showTrigger, setShowTrigger] = useState(checkInputAndOutput());
|
||||||
|
useEffect(() => {
|
||||||
|
setShowTrigger(checkInputAndOutput());
|
||||||
|
}, [nodes]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleKeyDown = (event: KeyboardEvent) => {
|
const handleKeyDown = (event: KeyboardEvent) => {
|
||||||
if (
|
if (
|
||||||
|
|
@ -34,13 +38,12 @@ export default function Chat({ flow }: ChatType): JSX.Element {
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const prevNodesRef = useRef<any[] | undefined>();
|
const prevNodesRef = useRef<any[] | undefined>();
|
||||||
const nodes: NodeType[] = useNodes();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<BuildTrigger open={open} flow={flow} />
|
<BuildTrigger open={open} flow={flow} />
|
||||||
{checkInputAndOutput() && (
|
{showTrigger && (
|
||||||
<BaseModal open={open} setOpen={setOpen}>
|
<BaseModal open={open} setOpen={setOpen}>
|
||||||
<BaseModal.Trigger asChild>
|
<BaseModal.Trigger asChild>
|
||||||
<ChatTrigger />
|
<ChatTrigger />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue