flows v0.1.14
This commit is contained in:
parent
d6a8f4437c
commit
ac93808e71
3 changed files with 36 additions and 2 deletions
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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 = [
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue