tui compose visibility
This commit is contained in:
parent
491f647572
commit
fdad859783
3 changed files with 32 additions and 4 deletions
|
|
@ -37,6 +37,9 @@ openrag = "tui.main:run_tui"
|
||||||
[tool.uv]
|
[tool.uv]
|
||||||
package = true
|
package = true
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
"*" = ["docker-compose*.yml"]
|
||||||
|
|
||||||
[tool.uv.sources]
|
[tool.uv.sources]
|
||||||
torch = [
|
torch = [
|
||||||
{ index = "pytorch-cu128", marker = "sys_platform == 'linux' and platform_machine == 'x86_64'" },
|
{ index = "pytorch-cu128", marker = "sys_platform == 'linux' and platform_machine == 'x86_64'" },
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ from enum import Enum
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Optional, AsyncIterator
|
from typing import Dict, List, Optional, AsyncIterator
|
||||||
from utils.logging_config import get_logger
|
from utils.logging_config import get_logger
|
||||||
|
try:
|
||||||
|
from importlib.resources import files
|
||||||
|
except ImportError:
|
||||||
|
from importlib_resources import files
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
@ -51,8 +55,8 @@ class ContainerManager:
|
||||||
def __init__(self, compose_file: Optional[Path] = None):
|
def __init__(self, compose_file: Optional[Path] = None):
|
||||||
self.platform_detector = PlatformDetector()
|
self.platform_detector = PlatformDetector()
|
||||||
self.runtime_info = self.platform_detector.detect_runtime()
|
self.runtime_info = self.platform_detector.detect_runtime()
|
||||||
self.compose_file = compose_file or Path("docker-compose.yml")
|
self.compose_file = compose_file or self._find_compose_file("docker-compose.yml")
|
||||||
self.cpu_compose_file = Path("docker-compose-cpu.yml")
|
self.cpu_compose_file = self._find_compose_file("docker-compose-cpu.yml")
|
||||||
self.services_cache: Dict[str, ServiceInfo] = {}
|
self.services_cache: Dict[str, ServiceInfo] = {}
|
||||||
self.last_status_update = 0
|
self.last_status_update = 0
|
||||||
# Auto-select CPU compose if no GPU available
|
# Auto-select CPU compose if no GPU available
|
||||||
|
|
@ -80,6 +84,27 @@ class ContainerManager:
|
||||||
"langflow": "langflow",
|
"langflow": "langflow",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _find_compose_file(self, filename: str) -> Path:
|
||||||
|
"""Find compose file in current directory or package resources."""
|
||||||
|
# First check current working directory
|
||||||
|
cwd_path = Path(filename)
|
||||||
|
if cwd_path.exists():
|
||||||
|
return cwd_path
|
||||||
|
|
||||||
|
# Then check package resources
|
||||||
|
try:
|
||||||
|
pkg_files = files("openrag")
|
||||||
|
if (pkg_files / filename).is_file():
|
||||||
|
# Copy to cwd for compose command to work
|
||||||
|
content = (pkg_files / filename).read_text()
|
||||||
|
cwd_path.write_text(content)
|
||||||
|
return cwd_path
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Fall back to original path (will fail later if not found)
|
||||||
|
return Path(filename)
|
||||||
|
|
||||||
def is_available(self) -> bool:
|
def is_available(self) -> bool:
|
||||||
"""Check if container runtime is available."""
|
"""Check if container runtime is available."""
|
||||||
return self.runtime_info.runtime_type != RuntimeType.NONE
|
return self.runtime_info.runtime_type != RuntimeType.NONE
|
||||||
|
|
|
||||||
4
uv.lock
generated
4
uv.lock
generated
|
|
@ -1,5 +1,5 @@
|
||||||
version = 1
|
version = 1
|
||||||
revision = 3
|
revision = 2
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
resolution-markers = [
|
resolution-markers = [
|
||||||
"sys_platform == 'darwin'",
|
"sys_platform == 'darwin'",
|
||||||
|
|
@ -2282,7 +2282,7 @@ wheels = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openrag"
|
name = "openrag"
|
||||||
version = "0.1.3"
|
version = "0.1.4"
|
||||||
source = { editable = "." }
|
source = { editable = "." }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "agentd" },
|
{ name = "agentd" },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue