diff --git a/Makefile b/Makefile index b474d072..bff4b922 100644 --- a/Makefile +++ b/Makefile @@ -151,6 +151,11 @@ init_proj: install_backend_env ## Initiates a new project using chatsky-ui cd ${BACKEND_DIR} && poetry run chatsky.ui init --destination ../ +.PHONY: init_with_cc +init_with_cc: ## Initiates a new project using cookiecutter + cookiecutter https://github.com/Ramimashkouk/df_d_template.git + + .PHONY: build_docs build_docs: install_backend_env ## Builds the docs cd ${BACKEND_DIR} && \ diff --git a/README.md b/README.md index 764f1309..fce37cbc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Quick Start ## System Requirements -Ensure you have Python version 3.8 or higher installed. +Ensure you have Python version 3.8.1 or higher installed. ## Installation To install the necessary package, run the following command: @@ -13,7 +13,7 @@ You may add a `.env` file in the root directory and configure any of following e ```.env HOST=0.0.0.0 PORT=8000 -CONF_RELOAD=True +CONF_RELOAD=False LOG_LEVEL=info GRACEFUL_TERMINATION_TIMEOUT=2 # Waiting for process to stop @@ -25,6 +25,8 @@ RUN_RUNNING_TIMEOUT=5 ``` ## Project Initiation +💡 You are encouraged to run `chatsky.ui --help` to explore the available CLI options. + Initialize your project by running: ```bash chatsky.ui init @@ -32,7 +34,10 @@ chatsky.ui init The `chatsky.ui init` command will start an interactive `cookiecutter` process to create a project based on a predefined template. The resulting project will be a simple example template that you can customize to suit your needs. ## Running Your Project -To run your project, use the following command: +To start your project, use the following command: ```bash -chatsky.ui run_app --project-dir # enter the slug you choose for your project with the help of the previous command +chatsky.ui run_app --project-dir # Replace with the slug you specified during initialization ``` + +## Documentation +You can refer to the [documentaion](https://deeppavlov.github.io/chatsky-ui/) to dig into the application code understanding. diff --git a/frontend/src/components/header/BuildMenu.tsx b/frontend/src/components/header/BuildMenu.tsx index 67452b26..0793fa89 100644 --- a/frontend/src/components/header/BuildMenu.tsx +++ b/frontend/src/components/header/BuildMenu.tsx @@ -13,7 +13,7 @@ import { parseSearchParams } from "../../utils" const BuildMenu = () => { const { buildStart, buildPending } = useContext(buildContext) const { chat, setChat } = useContext(chatContext) - const { runStart, runPending, runStatus, runStop, run } = useContext(runContext) + const { runStart, runPending, runStatus, runStop, run, setRunStatus } = useContext(runContext) const [searchParams, setSearchParams] = useSearchParams() return ( @@ -38,6 +38,7 @@ const BuildMenu = () => { style={{}} onClick={async () => { if (runStatus !== "alive") { + setRunStatus(() => 'running') await buildStart({ wait_time: 1, end_status: "success" }) await runStart({ end_status: "success", wait_time: 0 }) } else if (runStatus === "alive" && run) { diff --git a/frontend/src/components/nodes/LinkNode.tsx b/frontend/src/components/nodes/LinkNode.tsx index b17ebfc1..19b88878 100755 --- a/frontend/src/components/nodes/LinkNode.tsx +++ b/frontend/src/components/nodes/LinkNode.tsx @@ -1,5 +1,6 @@ import { Button, + Input, Modal, ModalBody, ModalContent, @@ -34,16 +35,18 @@ const LinkNode = memo(({ data }: { data: LinkNodeDataType }) => { const { updateNodeData } = useReactFlow() const { onOpen, onClose, isOpen } = useDisclosure() const { flows, deleteNode } = useContext(flowContext) + const [name, setName] = useState(data.name ?? "") const [toFlow, setToFlow] = useState() const [toNode, setToNode] = useState() const [error, setError] = useState(false) const [isConfigured, setIsConfigured] = useState(data.transition.is_configured ?? false) - // const [r, setR] = useState(0) const { notification: n } = useContext(NotificationsContext) - // const { openPopUp } = useContext(PopUpContext) + /** + * This useEffect checks if link configured + */ useEffect(() => { - if (data.transition.target_node) { + if (data.transition.is_configured) { const to_flow = flows.find((flow) => flow.data.nodes.some((node) => node.data.id === data.transition.target_node) ) @@ -55,10 +58,10 @@ const LinkNode = memo(({ data }: { data: LinkNodeDataType }) => { setToNode(to_node) } } - if (!data.transition.target_node) { + if (!data.transition.is_configured) { onOpen() } - // eslint-disable-next-line react-hooks/exhaustive-deps + // eslint-disable-next-line react-hooks/exhaustive-deps }, [data.transition.target_node]) const handleFlowSelectionChange = (e: React.ChangeEvent) => { @@ -78,6 +81,9 @@ const LinkNode = memo(({ data }: { data: LinkNodeDataType }) => { [TO_FLOW?.data.nodes, data.transition.target_node] ) + /** + * This useEffect checks the TO_FLOW and TO_NODE values is correct, and calls error if not + */ useEffect(() => { if ((!TO_FLOW || !TO_NODE) && isConfigured) { setError(true) @@ -89,9 +95,12 @@ const LinkNode = memo(({ data }: { data: LinkNodeDataType }) => { } else { setError(false) } - // eslint-disable-next-line react-hooks/exhaustive-deps + // eslint-disable-next-line react-hooks/exhaustive-deps }, [TO_FLOW, TO_NODE]) + /** + * This function will delete current link if TO_FLOW and TO_NODE values wasn't defined + */ const onDismiss = () => { setToFlow(TO_FLOW) setToNode(TO_NODE) @@ -103,15 +112,19 @@ const LinkNode = memo(({ data }: { data: LinkNodeDataType }) => { } } + /** + * Link data save function + */ const onSave = () => { if (toFlow && toNode) { updateNodeData(data.id, { ...data, + name: name, transition: { target_flow: toFlow.name, target_node: toNode.data.id, - is_configured: true - } + is_configured: true, + }, }) setIsConfigured(true) onClose() @@ -122,7 +135,7 @@ const LinkNode = memo(({ data }: { data: LinkNodeDataType }) => { <>
+ className={classNames(`default_node px-6 py-4`, error && "border-error")}>
{ ID: {data.id} - {((!toFlow || !toNode) && isConfigured) && ( + {(!toFlow || !toNode) && isConfigured && ( @@ -163,7 +176,8 @@ const LinkNode = memo(({ data }: { data: LinkNodeDataType }) => {
- {TO_FLOW ? TO_FLOW.name : isConfigured ? "ERROR" : ""} / {TO_NODE ? TO_NODE.data.name : isConfigured ? "ERROR" : ""} + {TO_FLOW ? TO_FLOW.name : isConfigured ? "ERROR" : ""} /{" "} + {TO_NODE ? TO_NODE.data.name : isConfigured ? "ERROR" : ""}
@@ -195,6 +209,16 @@ const LinkNode = memo(({ data }: { data: LinkNodeDataType }) => {
+
+ +