Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac93808e71 |
3 changed files with 36 additions and 2 deletions
|
|
@ -73,7 +73,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./documents:/app/documents:Z
|
- ./documents:/app/documents:Z
|
||||||
- ./keys:/app/keys:Z
|
- ./keys:/app/keys:Z
|
||||||
- ./flows:/app/flows:Z
|
- ./flows:/app/flows:z
|
||||||
|
|
||||||
openrag-frontend:
|
openrag-frontend:
|
||||||
image: phact/openrag-frontend:${OPENRAG_VERSION:-latest}
|
image: phact/openrag-frontend:${OPENRAG_VERSION:-latest}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "openrag"
|
name = "openrag"
|
||||||
version = "0.1.13"
|
version = "0.1.14"
|
||||||
description = "Add your description here"
|
description = "Add your description here"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
|
|
@ -37,6 +37,8 @@ openrag = "tui.main:run_tui"
|
||||||
[tool.uv]
|
[tool.uv]
|
||||||
package = true
|
package = true
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
"tui._assets" = ["**/*"]
|
||||||
|
|
||||||
[tool.uv.sources]
|
[tool.uv.sources]
|
||||||
torch = [
|
torch = [
|
||||||
|
|
|
||||||
|
|
@ -334,6 +334,35 @@ def copy_sample_documents():
|
||||||
# This is not a critical error - the app can work without 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():
|
def run_tui():
|
||||||
"""Run the OpenRAG TUI application."""
|
"""Run the OpenRAG TUI application."""
|
||||||
app = None
|
app = None
|
||||||
|
|
@ -341,6 +370,9 @@ def run_tui():
|
||||||
# Copy sample documents on first run
|
# Copy sample documents on first run
|
||||||
copy_sample_documents()
|
copy_sample_documents()
|
||||||
|
|
||||||
|
# Copy flows on first run
|
||||||
|
copy_flows()
|
||||||
|
|
||||||
app = OpenRAGTUI()
|
app = OpenRAGTUI()
|
||||||
app.run()
|
app.run()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue