Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Cleanup
Tomas Valenta4a4e5acd7fee
diff --git a/hooks/useBlock.ts b/hooks/useBlock.tsindex 2bf6fa106..c14a0dc0e 100644--- a/hooks/useBlock.ts+++ b/hooks/useBlock.ts@@ -1,7 +1,19 @@import { useCallback, useMemo } from 'react'+import { Route, BlockType, Block } from 'state/store'import { useStateStore } from 'state/StoreProvider'+/**+ *+ * For example, if there are two block for type `RequestBody` and we call `useBlock('RequestBody`, 2, route)`,+ * the hook will return the value and change handler for the second `RequestBody` block from the array of all blocks in the `route`.+ *+ * @param blockType type of block to filter+ * @param position which block from all the blocks with type `blockType` should this hook use.+ * The position starts from "1".+ * @param route+ * @returns+ */function useBlock(blockType: BlockType, position: number, route?: Route): [Block | undefined, (prompt: string) => void] {const [selectors] = useStateStore()@@ -10,7 +22,6 @@ function useBlock(blockType: BlockType, position: number, route?: Route): [Blockconst blockIdx = useMemo(() => {let count = 0return route?.blocks.findIndex((r, i) => {- console.log(blockType, position, count, r.type)if (r.type === blockType) {count++return count === position