Fix build button condition and prevent sending messages during build

This commit is contained in:
anovazzi1 2024-02-22 16:43:43 -03:00
commit 701571b858
2 changed files with 3 additions and 1 deletions

View file

@ -465,7 +465,7 @@ export default function GenericNode({
variant="outline" variant="outline"
className={"h-9 px-1.5"} className={"h-9 px-1.5"}
onClick={() => { onClick={() => {
if(data?.build_status === BuildStatus.BUILDING) return; if(data?.build_status === BuildStatus.BUILDING || isBuilding) return;
buildFlow(data.id) buildFlow(data.id)
}} }}
> >

View file

@ -35,6 +35,7 @@ export default function newChatView(): JSX.Element {
const setIsBuilding = useFlowStore((state) => state.setIsBuilding); const setIsBuilding = useFlowStore((state) => state.setIsBuilding);
const [lockChat, setLockChat] = useState(false); const [lockChat, setLockChat] = useState(false);
const messagesRef = useRef<HTMLDivElement | null>(null); const messagesRef = useRef<HTMLDivElement | null>(null);
const isBuilding = useFlowStore((state) => state.isBuilding);
const inputTypes = inputs.map((obj) => obj.type); const inputTypes = inputs.map((obj) => obj.type);
const inputIds = inputs.map((obj) => obj.id); const inputIds = inputs.map((obj) => obj.id);
@ -105,6 +106,7 @@ export default function newChatView(): JSX.Element {
}, []); }, []);
async function sendMessage(count = 1): Promise<void> { async function sendMessage(count = 1): Promise<void> {
if(isBuilding) return;
const { nodes, edges } = getFlow(); const { nodes, edges } = getFlow();
let nodeValidationErrors = validateNodes(nodes, edges); let nodeValidationErrors = validateNodes(nodes, edges);
if (nodeValidationErrors.length === 0) { if (nodeValidationErrors.length === 0) {