From ac93808e7113203f31adf4fe4d6df6fe95cb43c6 Mon Sep 17 00:00:00 2001 From: phact Date: Wed, 1 Oct 2025 12:17:54 -0400 Subject: [PATCH] flows v0.1.14 --- docker-compose-cpu.yml | 2 +- pyproject.toml | 4 +++- src/tui/main.py | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/docker-compose-cpu.yml b/docker-compose-cpu.yml index d0de6ce9..589e38b3 100644 --- a/docker-compose-cpu.yml +++ b/docker-compose-cpu.yml @@ -73,7 +73,7 @@ services: volumes: - ./documents:/app/documents:Z - ./keys:/app/keys:Z - - ./flows:/app/flows:Z + - ./flows:/app/flows:z openrag-frontend: image: phact/openrag-frontend:${OPENRAG_VERSION:-latest} diff --git a/pyproject.toml b/pyproject.toml index cc4db78a..4ada507b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openrag" -version = "0.1.13" +version = "0.1.14" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" @@ -37,6 +37,8 @@ openrag = "tui.main:run_tui" [tool.uv] package = true +[tool.setuptools.package-data] +"tui._assets" = ["**/*"] [tool.uv.sources] torch = [ diff --git a/src/tui/main.py b/src/tui/main.py index b68293fe..355046fc 100644 --- a/src/tui/main.py +++ b/src/tui/main.py @@ -334,6 +334,35 @@ def copy_sample_documents(): # This is not a critical error - the app can work without sample documents +def copy_flows(): + """Copy flows from package to current directory if they don't exist.""" + flows_dir = Path("flows") + + # Check if flows directory already exists and has files + if flows_dir.exists() and any(flows_dir.glob("*.json")): + return # Flows already exist, don't overwrite + + try: + # Get flows from package assets + assets_flows = files("tui._assets.flows") + + # Create flows directory if it doesn't exist + flows_dir.mkdir(exist_ok=True) + + # Copy each flow + for resource in assets_flows.iterdir(): + if resource.is_file() and resource.name.endswith('.json'): + dest_path = flows_dir / resource.name + if not dest_path.exists(): + content = resource.read_bytes() + dest_path.write_bytes(content) + logger.info(f"Copied flow: {resource.name}") + + except Exception as e: + logger.debug(f"Could not copy flows: {e}") + # This is not a critical error - the app can work without flows + + def run_tui(): """Run the OpenRAG TUI application.""" app = None @@ -341,6 +370,9 @@ def run_tui(): # Copy sample documents on first run copy_sample_documents() + # Copy flows on first run + copy_flows() + app = OpenRAGTUI() app.run() except KeyboardInterrupt: