Refactor imports to use absolute paths throughout project
Updated all relative imports to use absolute import paths for consistency and improved maintainability. Also replaced bare except clauses with 'except Exception' for better error handling, and made minor code cleanups such as removing unused variables and improving import order. No functional changes were made.
This commit is contained in:
parent
eaa56567ea
commit
a0a5cc4c60
38 changed files with 146 additions and 164 deletions
|
|
@ -1,11 +1,8 @@
|
||||||
|
from services.conversation_persistence_service import conversation_persistence
|
||||||
from utils.logging_config import get_logger
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
# Import persistent storage
|
|
||||||
from services.conversation_persistence_service import conversation_persistence
|
|
||||||
|
|
||||||
# In-memory storage for active conversation threads (preserves function calls)
|
# In-memory storage for active conversation threads (preserves function calls)
|
||||||
active_conversations = {}
|
active_conversations = {}
|
||||||
|
|
||||||
|
|
@ -447,7 +444,7 @@ async def async_chat_stream(
|
||||||
response_id = chunk_data["id"]
|
response_id = chunk_data["id"]
|
||||||
elif "response_id" in chunk_data:
|
elif "response_id" in chunk_data:
|
||||||
response_id = chunk_data["response_id"]
|
response_id = chunk_data["response_id"]
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
yield chunk
|
yield chunk
|
||||||
|
|
||||||
|
|
@ -641,7 +638,7 @@ async def async_langflow_chat_stream(
|
||||||
response_id = chunk_data["id"]
|
response_id = chunk_data["id"]
|
||||||
elif "response_id" in chunk_data:
|
elif "response_id" in chunk_data:
|
||||||
response_id = chunk_data["response_id"]
|
response_id = chunk_data["response_id"]
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
yield chunk
|
yield chunk
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -378,7 +378,7 @@ async def cancel_knowledge_filter_subscription(
|
||||||
return JSONResponse({"error": "Subscription not found"}, status_code=404)
|
return JSONResponse({"error": "Subscription not found"}, status_code=404)
|
||||||
|
|
||||||
# Delete the monitor
|
# Delete the monitor
|
||||||
monitor_result = await monitor_service.delete_monitor(
|
await monitor_service.delete_monitor(
|
||||||
subscription["monitor_id"], user.user_id, jwt_token
|
subscription["monitor_id"], user.user_id, jwt_token
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ from config.settings import DISABLE_INGEST_WITH_LANGFLOW
|
||||||
from utils.logging_config import get_logger
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
# Import the actual endpoint implementations
|
# Import the actual endpoint implementations
|
||||||
from .upload import upload as traditional_upload
|
from api.upload import upload as traditional_upload
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ load_dotenv("../", override=False)
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
# Import configuration manager
|
# Import configuration manager
|
||||||
from .config_manager import config_manager
|
from config.config_manager import config_manager
|
||||||
|
|
||||||
# Environment variables
|
# Environment variables
|
||||||
OPENSEARCH_HOST = os.getenv("OPENSEARCH_HOST", "localhost")
|
OPENSEARCH_HOST = os.getenv("OPENSEARCH_HOST", "localhost")
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from .base import BaseConnector
|
from connectors.base import BaseConnector
|
||||||
from .google_drive import GoogleDriveConnector
|
from connectors.google_drive import GoogleDriveConnector
|
||||||
from .sharepoint import SharePointConnector
|
from connectors.onedrive import OneDriveConnector
|
||||||
from .onedrive import OneDriveConnector
|
from connectors.sharepoint import SharePointConnector
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"BaseConnector",
|
"BaseConnector",
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,15 @@ from typing import Dict, List, Any, Optional
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from dataclasses import dataclass, asdict
|
from dataclasses import dataclass, asdict
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from connectors.base import BaseConnector
|
||||||
|
from connectors.google_drive import GoogleDriveConnector
|
||||||
|
from connectors.onedrive import OneDriveConnector
|
||||||
|
from connectors.sharepoint import SharePointConnector
|
||||||
from utils.logging_config import get_logger
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
from .base import BaseConnector
|
|
||||||
from .google_drive import GoogleDriveConnector
|
|
||||||
from .sharepoint import SharePointConnector
|
|
||||||
from .onedrive import OneDriveConnector
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ConnectionConfig:
|
class ConnectionConfig:
|
||||||
|
|
@ -290,7 +290,7 @@ class ConnectionManager:
|
||||||
and connector.webhook_channel_id
|
and connector.webhook_channel_id
|
||||||
):
|
):
|
||||||
await connector.cleanup_subscription(connector.webhook_channel_id)
|
await connector.cleanup_subscription(connector.webhook_channel_id)
|
||||||
except:
|
except Exception:
|
||||||
pass # Best effort cleanup
|
pass # Best effort cleanup
|
||||||
|
|
||||||
del self.active_connectors[connection_id]
|
del self.active_connectors[connection_id]
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from .connector import GoogleDriveConnector
|
from connectors.google_drive.connector import GoogleDriveConnector
|
||||||
from .oauth import GoogleDriveOAuth
|
from connectors.google_drive.oauth import GoogleDriveOAuth
|
||||||
|
|
||||||
__all__ = ["GoogleDriveConnector", "GoogleDriveOAuth"]
|
__all__ = ["GoogleDriveConnector", "GoogleDriveOAuth"]
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ from googleapiclient.http import MediaIoBaseDownload
|
||||||
|
|
||||||
from utils.logging_config import get_logger
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
from ..base import BaseConnector, ConnectorDocument, DocumentACL
|
from connectors.base import BaseConnector, ConnectorDocument, DocumentACL
|
||||||
from .oauth import GoogleDriveOAuth
|
from connectors.google_drive.oauth import GoogleDriveOAuth
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ from models.processors import LangflowConnectorFileProcessor
|
||||||
from services.langflow_file_service import LangflowFileService
|
from services.langflow_file_service import LangflowFileService
|
||||||
from utils.logging_config import get_logger
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
from .base import BaseConnector, ConnectorDocument
|
from connectors.base import BaseConnector, ConnectorDocument
|
||||||
from .connection_manager import ConnectionManager
|
from connectors.connection_manager import ConnectionManager
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from .connector import OneDriveConnector
|
from connectors.onedrive.connector import OneDriveConnector
|
||||||
from .oauth import OneDriveOAuth
|
from connectors.onedrive.oauth import OneDriveOAuth
|
||||||
|
|
||||||
__all__ = ["OneDriveConnector", "OneDriveOAuth"]
|
__all__ = ["OneDriveConnector", "OneDriveOAuth"]
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ from typing import List, Dict, Any, Optional
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
from ..base import BaseConnector, ConnectorDocument, DocumentACL
|
from connectors.base import BaseConnector, ConnectorDocument, DocumentACL
|
||||||
from .oauth import OneDriveOAuth
|
from connectors.onedrive.oauth import OneDriveOAuth
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from utils.logging_config import get_logger
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
from .base import BaseConnector, ConnectorDocument
|
from connectors.base import BaseConnector, ConnectorDocument
|
||||||
from .connection_manager import ConnectionManager
|
from connectors.connection_manager import ConnectionManager
|
||||||
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from .connector import SharePointConnector
|
from connectors.sharepoint.connector import SharePointConnector
|
||||||
from .oauth import SharePointOAuth
|
from connectors.sharepoint.oauth import SharePointOAuth
|
||||||
|
|
||||||
__all__ = ["SharePointConnector", "SharePointOAuth"]
|
__all__ = ["SharePointConnector", "SharePointOAuth"]
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ from urllib.parse import urlparse
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
from ..base import BaseConnector, ConnectorDocument, DocumentACL
|
from connectors.base import BaseConnector, ConnectorDocument, DocumentACL
|
||||||
from .oauth import SharePointOAuth
|
from connectors.sharepoint.oauth import SharePointOAuth
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
||||||
48
src/main.py
48
src/main.py
|
|
@ -1,15 +1,4 @@
|
||||||
# Configure structured logging early
|
# Configure structured logging early - must happen before other imports
|
||||||
from connectors.langflow_connector_service import LangflowConnectorService
|
|
||||||
from connectors.service import ConnectorService
|
|
||||||
from services.flows_service import FlowsService
|
|
||||||
from utils.container_utils import detect_container_environment
|
|
||||||
from utils.embeddings import create_dynamic_index_body
|
|
||||||
from utils.logging_config import configure_from_env, get_logger
|
|
||||||
from utils.telemetry import TelemetryClient, Category, MessageId
|
|
||||||
|
|
||||||
configure_from_env()
|
|
||||||
logger = get_logger(__name__)
|
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import atexit
|
import atexit
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
|
@ -20,14 +9,6 @@ from functools import partial
|
||||||
from starlette.applications import Starlette
|
from starlette.applications import Starlette
|
||||||
from starlette.routing import Route
|
from starlette.routing import Route
|
||||||
|
|
||||||
# Set multiprocessing start method to 'spawn' for CUDA compatibility
|
|
||||||
multiprocessing.set_start_method("spawn", force=True)
|
|
||||||
|
|
||||||
# Create process pool FIRST, before any torch/CUDA imports
|
|
||||||
from utils.process_pool import process_pool # isort: skip
|
|
||||||
import torch
|
|
||||||
|
|
||||||
# API endpoints
|
|
||||||
from api import (
|
from api import (
|
||||||
auth,
|
auth,
|
||||||
chat,
|
chat,
|
||||||
|
|
@ -47,12 +28,8 @@ from api import (
|
||||||
tasks,
|
tasks,
|
||||||
upload,
|
upload,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Existing services
|
|
||||||
from api.connector_router import ConnectorRouter
|
from api.connector_router import ConnectorRouter
|
||||||
from auth_middleware import optional_auth, require_auth
|
from auth_middleware import optional_auth, require_auth
|
||||||
|
|
||||||
# Configuration and setup
|
|
||||||
from config.settings import (
|
from config.settings import (
|
||||||
DISABLE_INGEST_WITH_LANGFLOW,
|
DISABLE_INGEST_WITH_LANGFLOW,
|
||||||
INDEX_BODY,
|
INDEX_BODY,
|
||||||
|
|
@ -63,22 +40,33 @@ from config.settings import (
|
||||||
is_no_auth_mode,
|
is_no_auth_mode,
|
||||||
get_openrag_config,
|
get_openrag_config,
|
||||||
)
|
)
|
||||||
|
from connectors.langflow_connector_service import LangflowConnectorService
|
||||||
|
from connectors.service import ConnectorService
|
||||||
from services.auth_service import AuthService
|
from services.auth_service import AuthService
|
||||||
from services.langflow_mcp_service import LangflowMCPService
|
|
||||||
from services.chat_service import ChatService
|
from services.chat_service import ChatService
|
||||||
|
|
||||||
# Services
|
|
||||||
from services.document_service import DocumentService
|
from services.document_service import DocumentService
|
||||||
|
from services.flows_service import FlowsService
|
||||||
from services.knowledge_filter_service import KnowledgeFilterService
|
from services.knowledge_filter_service import KnowledgeFilterService
|
||||||
|
|
||||||
# Configuration and setup
|
|
||||||
# Services
|
|
||||||
from services.langflow_file_service import LangflowFileService
|
from services.langflow_file_service import LangflowFileService
|
||||||
|
from services.langflow_mcp_service import LangflowMCPService
|
||||||
from services.models_service import ModelsService
|
from services.models_service import ModelsService
|
||||||
from services.monitor_service import MonitorService
|
from services.monitor_service import MonitorService
|
||||||
from services.search_service import SearchService
|
from services.search_service import SearchService
|
||||||
from services.task_service import TaskService
|
from services.task_service import TaskService
|
||||||
from session_manager import SessionManager
|
from session_manager import SessionManager
|
||||||
|
from utils.container_utils import detect_container_environment
|
||||||
|
from utils.embeddings import create_dynamic_index_body
|
||||||
|
from utils.logging_config import configure_from_env, get_logger
|
||||||
|
from utils.process_pool import process_pool
|
||||||
|
from utils.telemetry import TelemetryClient, Category, MessageId
|
||||||
|
|
||||||
|
import torch
|
||||||
|
|
||||||
|
configure_from_env()
|
||||||
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
# Set multiprocessing start method to 'spawn' for CUDA compatibility
|
||||||
|
multiprocessing.set_start_method("spawn", force=True)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
"CUDA device information",
|
"CUDA device information",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from .tasks import UploadTask, FileTask
|
|
||||||
|
from models.tasks import UploadTask, FileTask
|
||||||
from utils.logging_config import get_logger
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
import os
|
import os
|
||||||
from docling_core.types.io import DocumentStream
|
|
||||||
from typing import List
|
from typing import List
|
||||||
import tiktoken
|
|
||||||
from utils.logging_config import get_logger
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
import tiktoken
|
||||||
|
from docling_core.types.io import DocumentStream
|
||||||
|
|
||||||
from config.settings import clients, INDEX_NAME, get_embedding_model
|
from config.settings import clients, INDEX_NAME, get_embedding_model
|
||||||
from utils.document_processing import extract_relevant
|
from utils.document_processing import extract_relevant
|
||||||
|
from utils.logging_config import get_logger
|
||||||
from utils.telemetry import TelemetryClient, Category, MessageId
|
from utils.telemetry import TelemetryClient, Category, MessageId
|
||||||
|
|
||||||
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_token_count(text: str, model: str = None) -> int:
|
def get_token_count(text: str, model: str = None) -> int:
|
||||||
"""Get accurate token count using tiktoken"""
|
"""Get accurate token count using tiktoken"""
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,7 @@ class FlowsService:
|
||||||
)
|
)
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
result = response.json()
|
response.json()
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Successfully reset {flow_type} flow",
|
f"Successfully reset {flow_type} flow",
|
||||||
flow_id=flow_id,
|
flow_id=flow_id,
|
||||||
|
|
@ -427,7 +427,7 @@ class FlowsService:
|
||||||
|
|
||||||
# Get provider-specific endpoint if needed
|
# Get provider-specific endpoint if needed
|
||||||
llm_provider_config = config.get_llm_provider_config()
|
llm_provider_config = config.get_llm_provider_config()
|
||||||
endpoint = getattr(llm_provider_config, "endpoint", None)
|
_ = getattr(llm_provider_config, "endpoint", None)
|
||||||
|
|
||||||
# Step 2: Update model values for the specific flow being reset
|
# Step 2: Update model values for the specific flow being reset
|
||||||
single_flow_config = [
|
single_flow_config = [
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,6 @@ from datetime import datetime, timedelta
|
||||||
from typing import Dict, Optional, Any
|
from typing import Dict, Optional, Any
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from cryptography.hazmat.primitives import serialization
|
from cryptography.hazmat.primitives import serialization
|
||||||
from utils.logging_config import get_logger
|
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
|
||||||
|
|
||||||
from utils.logging_config import get_logger
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
"""OpenRAG Terminal User Interface package."""
|
"""OpenRAG Terminal User Interface package."""
|
||||||
|
|
||||||
from .utils.version_check import get_current_version
|
from tui.utils.version_check import get_current_version
|
||||||
|
|
||||||
__version__ = get_current_version()
|
__version__ = get_current_version()
|
||||||
|
|
|
||||||
|
|
@ -3,22 +3,23 @@
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Iterable, Optional
|
from typing import Iterable, Optional
|
||||||
|
|
||||||
from textual.app import App
|
from textual.app import App
|
||||||
from utils.logging_config import get_logger
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from importlib.resources import files
|
from importlib.resources import files
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from importlib_resources import files
|
from importlib_resources import files
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
from tui.managers.container_manager import ContainerManager
|
||||||
|
from tui.managers.docling_manager import DoclingManager
|
||||||
|
from tui.managers.env_manager import EnvManager
|
||||||
|
from tui.screens.welcome import WelcomeScreen
|
||||||
|
from tui.utils.platform import PlatformDetector
|
||||||
|
from tui.widgets.diagnostics_notification import notify_with_diagnostics
|
||||||
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
from .screens.welcome import WelcomeScreen
|
logger = get_logger(__name__)
|
||||||
from .managers.env_manager import EnvManager
|
|
||||||
from .managers.container_manager import ContainerManager
|
|
||||||
from .managers.docling_manager import DoclingManager
|
|
||||||
from .utils.platform import PlatformDetector
|
|
||||||
from .widgets.diagnostics_notification import notify_with_diagnostics
|
|
||||||
|
|
||||||
|
|
||||||
class OpenRAGTUI(App):
|
class OpenRAGTUI(App):
|
||||||
|
|
@ -392,7 +393,7 @@ class OpenRAGTUI(App):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Load existing config if available
|
# Load existing config if available
|
||||||
config_exists = self.env_manager.load_existing_env()
|
self.env_manager.load_existing_env()
|
||||||
|
|
||||||
# Start with welcome screen
|
# Start with welcome screen
|
||||||
self.push_screen(WelcomeScreen())
|
self.push_screen(WelcomeScreen())
|
||||||
|
|
@ -526,7 +527,7 @@ def copy_compose_files(*, force: bool = False) -> None:
|
||||||
def run_tui():
|
def run_tui():
|
||||||
"""Run the OpenRAG TUI application."""
|
"""Run the OpenRAG TUI application."""
|
||||||
# Check for native Windows before launching TUI
|
# Check for native Windows before launching TUI
|
||||||
from .utils.platform import PlatformDetector
|
from tui.utils.platform import PlatformDetector
|
||||||
|
|
||||||
platform_detector = PlatformDetector()
|
platform_detector = PlatformDetector()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,17 @@ from dataclasses import dataclass, field
|
||||||
from enum import Enum
|
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
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from importlib.resources import files
|
from importlib.resources import files
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from importlib_resources import files
|
from importlib_resources import files
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
from tui.utils.platform import PlatformDetector, RuntimeInfo, RuntimeType
|
||||||
|
|
||||||
from ..utils.platform import PlatformDetector, RuntimeInfo, RuntimeType
|
|
||||||
from utils.gpu_detection import detect_gpu_devices
|
from utils.gpu_detection import detect_gpu_devices
|
||||||
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ServiceStatus(Enum):
|
class ServiceStatus(Enum):
|
||||||
|
|
@ -572,7 +572,7 @@ class ContainerManager:
|
||||||
Tuple of (has_mismatch, container_version, tui_version)
|
Tuple of (has_mismatch, container_version, tui_version)
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
from ..utils.version_check import get_current_version
|
from tui.utils.version_check import get_current_version
|
||||||
|
|
||||||
tui_version = get_current_version()
|
tui_version = get_current_version()
|
||||||
if tui_version == "unknown":
|
if tui_version == "unknown":
|
||||||
|
|
@ -585,7 +585,7 @@ class ContainerManager:
|
||||||
return False, None, tui_version
|
return False, None, tui_version
|
||||||
|
|
||||||
# Compare versions
|
# Compare versions
|
||||||
from ..utils.version_check import compare_versions
|
from tui.utils.version_check import compare_versions
|
||||||
|
|
||||||
comparison = compare_versions(container_version, tui_version)
|
comparison = compare_versions(container_version, tui_version)
|
||||||
has_mismatch = comparison != 0
|
has_mismatch = comparison != 0
|
||||||
|
|
@ -891,7 +891,7 @@ class ContainerManager:
|
||||||
|
|
||||||
# Ensure OPENRAG_VERSION is set in .env file
|
# Ensure OPENRAG_VERSION is set in .env file
|
||||||
try:
|
try:
|
||||||
from ..managers.env_manager import EnvManager
|
from tui.managers.env_manager import EnvManager
|
||||||
|
|
||||||
env_manager = EnvManager()
|
env_manager = EnvManager()
|
||||||
env_manager.ensure_openrag_version()
|
env_manager.ensure_openrag_version()
|
||||||
|
|
|
||||||
|
|
@ -332,7 +332,7 @@ class DoclingManager:
|
||||||
# Service is now running, clear starting flag
|
# Service is now running, clear starting flag
|
||||||
self._starting = False
|
self._starting = False
|
||||||
break
|
break
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self._add_log_entry(f"Waiting for startup... ({i + 1}/10)")
|
self._add_log_entry(f"Waiting for startup... ({i + 1}/10)")
|
||||||
|
|
@ -555,7 +555,7 @@ class DoclingManager:
|
||||||
"""Follow logs from the docling-serve process in real-time."""
|
"""Follow logs from the docling-serve process in real-time."""
|
||||||
# First yield status message and any existing logs
|
# First yield status message and any existing logs
|
||||||
display_host = "localhost" if self._host == "0.0.0.0" else self._host
|
display_host = "localhost" if self._host == "0.0.0.0" else self._host
|
||||||
status_msg = f"Docling serve is running on http://{display_host}:{self._port}"
|
_ = f"Docling serve is running on http://{display_host}:{self._port}"
|
||||||
|
|
||||||
with self._log_lock:
|
with self._log_lock:
|
||||||
if self._log_buffer:
|
if self._log_buffer:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
"""Environment configuration manager for OpenRAG TUI."""
|
"""Environment configuration manager for OpenRAG TUI."""
|
||||||
|
|
||||||
|
import os
|
||||||
import secrets
|
import secrets
|
||||||
import string
|
import string
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|
@ -7,11 +8,7 @@ from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
|
|
||||||
from utils.logging_config import get_logger
|
from tui.utils.validation import (
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
|
||||||
|
|
||||||
from ..utils.validation import (
|
|
||||||
sanitize_env_value,
|
sanitize_env_value,
|
||||||
validate_documents_paths,
|
validate_documents_paths,
|
||||||
validate_google_oauth_client_id,
|
validate_google_oauth_client_id,
|
||||||
|
|
@ -19,6 +16,9 @@ from ..utils.validation import (
|
||||||
validate_openai_api_key,
|
validate_openai_api_key,
|
||||||
validate_url,
|
validate_url,
|
||||||
)
|
)
|
||||||
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
|
logger = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|
@ -201,7 +201,7 @@ class EnvManager:
|
||||||
# Set OPENRAG_VERSION to TUI version if not already set
|
# Set OPENRAG_VERSION to TUI version if not already set
|
||||||
if not self.config.openrag_version:
|
if not self.config.openrag_version:
|
||||||
try:
|
try:
|
||||||
from ..utils.version_check import get_current_version
|
from tui.utils.version_check import get_current_version
|
||||||
|
|
||||||
current_version = get_current_version()
|
current_version = get_current_version()
|
||||||
if current_version != "unknown":
|
if current_version != "unknown":
|
||||||
|
|
@ -241,7 +241,7 @@ class EnvManager:
|
||||||
)
|
)
|
||||||
|
|
||||||
# Import validation functions for new provider fields
|
# Import validation functions for new provider fields
|
||||||
from ..utils.validation import validate_anthropic_api_key
|
from tui.utils.validation import validate_anthropic_api_key
|
||||||
|
|
||||||
# Validate Anthropic API key format if provided
|
# Validate Anthropic API key format if provided
|
||||||
if self.config.anthropic_api_key:
|
if self.config.anthropic_api_key:
|
||||||
|
|
@ -382,7 +382,7 @@ class EnvManager:
|
||||||
else:
|
else:
|
||||||
# Fallback: try to get current version
|
# Fallback: try to get current version
|
||||||
try:
|
try:
|
||||||
from ..utils.version_check import get_current_version
|
from tui.utils.version_check import get_current_version
|
||||||
|
|
||||||
current_version = get_current_version()
|
current_version = get_current_version()
|
||||||
if current_version != "unknown":
|
if current_version != "unknown":
|
||||||
|
|
@ -578,7 +578,7 @@ class EnvManager:
|
||||||
def ensure_openrag_version(self) -> None:
|
def ensure_openrag_version(self) -> None:
|
||||||
"""Ensure OPENRAG_VERSION is set in .env file to match TUI version."""
|
"""Ensure OPENRAG_VERSION is set in .env file to match TUI version."""
|
||||||
try:
|
try:
|
||||||
from ..utils.version_check import get_current_version
|
from tui.utils.version_check import get_current_version
|
||||||
|
|
||||||
current_version = get_current_version()
|
current_version = get_current_version()
|
||||||
if current_version == "unknown":
|
if current_version == "unknown":
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ from textual.validation import ValidationResult, Validator
|
||||||
from rich.text import Text
|
from rich.text import Text
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from ..managers.env_manager import EnvManager
|
from tui.managers.env_manager import EnvManager
|
||||||
from ..utils.validation import (
|
from tui.utils.validation import (
|
||||||
validate_openai_api_key,
|
validate_openai_api_key,
|
||||||
validate_anthropic_api_key,
|
validate_anthropic_api_key,
|
||||||
validate_ollama_endpoint,
|
validate_ollama_endpoint,
|
||||||
|
|
@ -235,9 +235,6 @@ class ConfigScreen(Screen):
|
||||||
yield Static(" ")
|
yield Static(" ")
|
||||||
|
|
||||||
# Langflow Admin Username - conditionally displayed based on password
|
# Langflow Admin Username - conditionally displayed based on password
|
||||||
current_password = getattr(
|
|
||||||
self.env_manager.config, "langflow_superuser_password", ""
|
|
||||||
)
|
|
||||||
yield Label("Langflow Admin Username *", id="langflow-username-label")
|
yield Label("Langflow Admin Username *", id="langflow-username-label")
|
||||||
current_value = getattr(self.env_manager.config, "langflow_superuser", "")
|
current_value = getattr(self.env_manager.config, "langflow_superuser", "")
|
||||||
input_widget = Input(
|
input_widget = Input(
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ from textual.screen import Screen
|
||||||
from textual.widgets import Header, Footer, Static, Button, Log
|
from textual.widgets import Header, Footer, Static, Button, Log
|
||||||
from rich.text import Text
|
from rich.text import Text
|
||||||
|
|
||||||
from ..managers.container_manager import ContainerManager
|
from tui.managers.container_manager import ContainerManager
|
||||||
from ..utils.clipboard import copy_text_to_clipboard
|
from tui.utils.clipboard import copy_text_to_clipboard
|
||||||
from ..utils.platform import PlatformDetector
|
from tui.utils.platform import PlatformDetector
|
||||||
|
|
||||||
|
|
||||||
class DiagnosticsScreen(Screen):
|
class DiagnosticsScreen(Screen):
|
||||||
|
|
@ -435,7 +435,7 @@ class DiagnosticsScreen(Screen):
|
||||||
log.write(
|
log.write(
|
||||||
f" OpenSearch version: {info['version']['number']}"
|
f" OpenSearch version: {info['version']['number']}"
|
||||||
)
|
)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
log.write(
|
log.write(
|
||||||
|
|
@ -483,7 +483,7 @@ class DiagnosticsScreen(Screen):
|
||||||
if "tenants" in user_info:
|
if "tenants" in user_info:
|
||||||
tenants = list(user_info["tenants"].keys())
|
tenants = list(user_info["tenants"].keys())
|
||||||
log.write(f" Tenants: {', '.join(tenants)}")
|
log.write(f" Tenants: {', '.join(tenants)}")
|
||||||
except:
|
except Exception:
|
||||||
log.write(" Account info retrieved but couldn't parse JSON")
|
log.write(" Account info retrieved but couldn't parse JSON")
|
||||||
else:
|
else:
|
||||||
log.write(
|
log.write(
|
||||||
|
|
@ -527,7 +527,7 @@ class DiagnosticsScreen(Screen):
|
||||||
if admin_user.get("reserved"):
|
if admin_user.get("reserved"):
|
||||||
log.write(" Admin user is reserved (protected)")
|
log.write(" Admin user is reserved (protected)")
|
||||||
log.write(f" Total internal users: {len(users)}")
|
log.write(f" Total internal users: {len(users)}")
|
||||||
except:
|
except Exception:
|
||||||
log.write("[green]✓ Internal users endpoint accessible[/green]")
|
log.write("[green]✓ Internal users endpoint accessible[/green]")
|
||||||
else:
|
else:
|
||||||
log.write(
|
log.write(
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,9 @@ from textual.screen import Screen
|
||||||
from textual.widgets import Footer, Static, Button, TextArea
|
from textual.widgets import Footer, Static, Button, TextArea
|
||||||
from rich.text import Text
|
from rich.text import Text
|
||||||
|
|
||||||
from ..managers.container_manager import ContainerManager
|
from tui.managers.container_manager import ContainerManager
|
||||||
from ..managers.docling_manager import DoclingManager
|
from tui.managers.docling_manager import DoclingManager
|
||||||
from ..utils.clipboard import copy_text_to_clipboard
|
from tui.utils.clipboard import copy_text_to_clipboard
|
||||||
|
|
||||||
|
|
||||||
class LogsScreen(Screen):
|
class LogsScreen(Screen):
|
||||||
|
|
|
||||||
|
|
@ -6,24 +6,24 @@ import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Literal, Optional, AsyncIterator
|
from typing import Literal, Optional, AsyncIterator
|
||||||
|
|
||||||
# Define button variant type
|
from rich.text import Text
|
||||||
ButtonVariant = Literal["default", "primary", "success", "warning", "error"]
|
|
||||||
|
|
||||||
from textual.app import ComposeResult
|
from textual.app import ComposeResult
|
||||||
from textual.containers import Horizontal, ScrollableContainer
|
from textual.containers import Horizontal, ScrollableContainer
|
||||||
from textual.screen import Screen
|
from textual.screen import Screen
|
||||||
from textual.widgets import Footer, Static, Button, DataTable
|
from textual.widgets import Footer, Static, Button, DataTable
|
||||||
from rich.text import Text
|
|
||||||
|
|
||||||
from ..managers.container_manager import ContainerManager, ServiceStatus, ServiceInfo
|
from tui.managers.container_manager import ContainerManager, ServiceStatus, ServiceInfo
|
||||||
from ..managers.docling_manager import DoclingManager
|
from tui.managers.docling_manager import DoclingManager
|
||||||
from ..utils.platform import RuntimeType
|
from tui.utils.platform import RuntimeType
|
||||||
from ..widgets.command_modal import CommandOutputModal
|
from tui.widgets.command_modal import CommandOutputModal
|
||||||
from ..widgets.flow_backup_warning_modal import FlowBackupWarningModal
|
from tui.widgets.diagnostics_notification import notify_with_diagnostics
|
||||||
from ..widgets.factory_reset_warning_modal import FactoryResetWarningModal
|
from tui.widgets.factory_reset_warning_modal import FactoryResetWarningModal
|
||||||
from ..widgets.version_mismatch_warning_modal import VersionMismatchWarningModal
|
from tui.widgets.flow_backup_warning_modal import FlowBackupWarningModal
|
||||||
from ..widgets.upgrade_instructions_modal import UpgradeInstructionsModal
|
from tui.widgets.upgrade_instructions_modal import UpgradeInstructionsModal
|
||||||
from ..widgets.diagnostics_notification import notify_with_diagnostics
|
from tui.widgets.version_mismatch_warning_modal import VersionMismatchWarningModal
|
||||||
|
|
||||||
|
# Define button variant type
|
||||||
|
ButtonVariant = Literal["default", "primary", "success", "warning", "error"]
|
||||||
|
|
||||||
|
|
||||||
class MonitorScreen(Screen):
|
class MonitorScreen(Screen):
|
||||||
|
|
@ -280,7 +280,6 @@ class MonitorScreen(Screen):
|
||||||
def on_button_pressed(self, event: Button.Pressed) -> None:
|
def on_button_pressed(self, event: Button.Pressed) -> None:
|
||||||
"""Handle button presses."""
|
"""Handle button presses."""
|
||||||
button_id = event.button.id or ""
|
button_id = event.button.id or ""
|
||||||
button_label = event.button.label or ""
|
|
||||||
|
|
||||||
# Use button ID prefixes to determine action, ignoring any random suffix
|
# Use button ID prefixes to determine action, ignoring any random suffix
|
||||||
if button_id.startswith("start-btn"):
|
if button_id.startswith("start-btn"):
|
||||||
|
|
@ -369,7 +368,7 @@ class MonitorScreen(Screen):
|
||||||
# Ensure OPENRAG_VERSION is set in .env BEFORE starting services
|
# Ensure OPENRAG_VERSION is set in .env BEFORE starting services
|
||||||
# This ensures docker compose reads the correct version
|
# This ensures docker compose reads the correct version
|
||||||
try:
|
try:
|
||||||
from ..managers.env_manager import EnvManager
|
from tui.managers.env_manager import EnvManager
|
||||||
|
|
||||||
env_manager = EnvManager()
|
env_manager = EnvManager()
|
||||||
env_manager.ensure_openrag_version()
|
env_manager.ensure_openrag_version()
|
||||||
|
|
@ -430,7 +429,7 @@ class MonitorScreen(Screen):
|
||||||
"""Check TUI version and show upgrade instructions."""
|
"""Check TUI version and show upgrade instructions."""
|
||||||
self.operation_in_progress = True
|
self.operation_in_progress = True
|
||||||
try:
|
try:
|
||||||
from ..utils.version_check import check_if_latest
|
from tui.utils.version_check import check_if_latest
|
||||||
|
|
||||||
# Check if current version is latest
|
# Check if current version is latest
|
||||||
is_latest, latest_version, current_version = await check_if_latest()
|
is_latest, latest_version, current_version = await check_if_latest()
|
||||||
|
|
@ -646,7 +645,7 @@ class MonitorScreen(Screen):
|
||||||
|
|
||||||
def _view_docling_logs(self) -> None:
|
def _view_docling_logs(self) -> None:
|
||||||
"""View docling serve logs."""
|
"""View docling serve logs."""
|
||||||
from .logs import LogsScreen
|
from tui.screens.logs import LogsScreen
|
||||||
|
|
||||||
self.app.push_screen(LogsScreen(initial_service="docling-serve"))
|
self.app.push_screen(LogsScreen(initial_service="docling-serve"))
|
||||||
|
|
||||||
|
|
@ -931,7 +930,7 @@ class MonitorScreen(Screen):
|
||||||
selected_service = self._get_selected_service()
|
selected_service = self._get_selected_service()
|
||||||
if selected_service:
|
if selected_service:
|
||||||
# Push the logs screen with the selected service
|
# Push the logs screen with the selected service
|
||||||
from .logs import LogsScreen
|
from tui.screens.logs import LogsScreen
|
||||||
|
|
||||||
logs_screen = LogsScreen(initial_service=selected_service)
|
logs_screen = LogsScreen(initial_service=selected_service)
|
||||||
self.app.push_screen(logs_screen)
|
self.app.push_screen(logs_screen)
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,12 @@ from textual.widgets import Footer, Static, Button
|
||||||
from rich.text import Text
|
from rich.text import Text
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
from .. import __version__
|
from tui import __version__
|
||||||
from ..managers.container_manager import ContainerManager, ServiceStatus
|
from tui.managers.container_manager import ContainerManager, ServiceStatus
|
||||||
from ..managers.env_manager import EnvManager
|
from tui.managers.docling_manager import DoclingManager
|
||||||
from ..managers.docling_manager import DoclingManager
|
from tui.managers.env_manager import EnvManager
|
||||||
from ..widgets.command_modal import CommandOutputModal
|
from tui.widgets.command_modal import CommandOutputModal
|
||||||
from ..widgets.version_mismatch_warning_modal import VersionMismatchWarningModal
|
from tui.widgets.version_mismatch_warning_modal import VersionMismatchWarningModal
|
||||||
|
|
||||||
|
|
||||||
class WelcomeScreen(Screen):
|
class WelcomeScreen(Screen):
|
||||||
|
|
@ -280,7 +280,7 @@ class WelcomeScreen(Screen):
|
||||||
try:
|
try:
|
||||||
welcome_widget = self.query_one("#welcome-text")
|
welcome_widget = self.query_one("#welcome-text")
|
||||||
welcome_widget.update(self._create_welcome_text())
|
welcome_widget.update(self._create_welcome_text())
|
||||||
except:
|
except Exception:
|
||||||
pass # Widget might not be mounted yet
|
pass # Widget might not be mounted yet
|
||||||
|
|
||||||
# Focus the appropriate button (the buttons are created correctly in compose,
|
# Focus the appropriate button (the buttons are created correctly in compose,
|
||||||
|
|
@ -296,7 +296,7 @@ class WelcomeScreen(Screen):
|
||||||
self.query_one("#advanced-setup-btn").focus()
|
self.query_one("#advanced-setup-btn").focus()
|
||||||
else:
|
else:
|
||||||
self.query_one("#basic-setup-btn").focus()
|
self.query_one("#basic-setup-btn").focus()
|
||||||
except:
|
except Exception:
|
||||||
pass # Button might not exist
|
pass # Button might not exist
|
||||||
|
|
||||||
async def on_screen_resume(self) -> None:
|
async def on_screen_resume(self) -> None:
|
||||||
|
|
@ -346,25 +346,25 @@ class WelcomeScreen(Screen):
|
||||||
|
|
||||||
def action_no_auth_setup(self) -> None:
|
def action_no_auth_setup(self) -> None:
|
||||||
"""Switch to basic configuration screen."""
|
"""Switch to basic configuration screen."""
|
||||||
from .config import ConfigScreen
|
from tui.screens.config import ConfigScreen
|
||||||
|
|
||||||
self.app.push_screen(ConfigScreen(mode="no_auth"))
|
self.app.push_screen(ConfigScreen(mode="no_auth"))
|
||||||
|
|
||||||
def action_full_setup(self) -> None:
|
def action_full_setup(self) -> None:
|
||||||
"""Switch to advanced configuration screen."""
|
"""Switch to advanced configuration screen."""
|
||||||
from .config import ConfigScreen
|
from tui.screens.config import ConfigScreen
|
||||||
|
|
||||||
self.app.push_screen(ConfigScreen(mode="full"))
|
self.app.push_screen(ConfigScreen(mode="full"))
|
||||||
|
|
||||||
def action_monitor(self) -> None:
|
def action_monitor(self) -> None:
|
||||||
"""Switch to monitoring screen."""
|
"""Switch to monitoring screen."""
|
||||||
from .monitor import MonitorScreen
|
from tui.screens.monitor import MonitorScreen
|
||||||
|
|
||||||
self.app.push_screen(MonitorScreen())
|
self.app.push_screen(MonitorScreen())
|
||||||
|
|
||||||
def action_diagnostics(self) -> None:
|
def action_diagnostics(self) -> None:
|
||||||
"""Switch to diagnostics screen."""
|
"""Switch to diagnostics screen."""
|
||||||
from .diagnostics import DiagnosticsScreen
|
from tui.screens.diagnostics import DiagnosticsScreen
|
||||||
|
|
||||||
self.app.push_screen(DiagnosticsScreen())
|
self.app.push_screen(DiagnosticsScreen())
|
||||||
|
|
||||||
|
|
@ -471,7 +471,7 @@ class WelcomeScreen(Screen):
|
||||||
# Ensure OPENRAG_VERSION is set in .env BEFORE starting services
|
# Ensure OPENRAG_VERSION is set in .env BEFORE starting services
|
||||||
# This ensures docker compose reads the correct version
|
# This ensures docker compose reads the correct version
|
||||||
try:
|
try:
|
||||||
from ..managers.env_manager import EnvManager
|
from tui.managers.env_manager import EnvManager
|
||||||
|
|
||||||
env_manager = EnvManager()
|
env_manager = EnvManager()
|
||||||
env_manager.ensure_openrag_version()
|
env_manager.ensure_openrag_version()
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"""Widgets for OpenRAG TUI."""
|
"""Widgets for OpenRAG TUI."""
|
||||||
|
|
||||||
from .flow_backup_warning_modal import FlowBackupWarningModal
|
from tui.widgets.flow_backup_warning_modal import FlowBackupWarningModal
|
||||||
|
|
||||||
__all__ = ["FlowBackupWarningModal"]
|
__all__ = ["FlowBackupWarningModal"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ from textual.containers import Container
|
||||||
from textual.screen import ModalScreen
|
from textual.screen import ModalScreen
|
||||||
from textual.widgets import Button, Static, Label, TextArea, Footer
|
from textual.widgets import Button, Static, Label, TextArea, Footer
|
||||||
|
|
||||||
from ..utils.clipboard import copy_text_to_clipboard
|
from tui.utils.clipboard import copy_text_to_clipboard
|
||||||
from .waves import Waves
|
from tui.widgets.waves import Waves
|
||||||
|
|
||||||
|
|
||||||
class CommandOutputModal(ModalScreen):
|
class CommandOutputModal(ModalScreen):
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ def notify_with_diagnostics(
|
||||||
|
|
||||||
# Then add a button to open diagnostics screen
|
# Then add a button to open diagnostics screen
|
||||||
def open_diagnostics() -> None:
|
def open_diagnostics() -> None:
|
||||||
from ..screens.diagnostics import DiagnosticsScreen
|
from tui.screens.diagnostics import DiagnosticsScreen
|
||||||
|
|
||||||
app.push_screen(DiagnosticsScreen())
|
app.push_screen(DiagnosticsScreen())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ def notify_with_diagnostics(
|
||||||
|
|
||||||
# Then add a button to open diagnostics screen
|
# Then add a button to open diagnostics screen
|
||||||
def open_diagnostics() -> None:
|
def open_diagnostics() -> None:
|
||||||
from ..screens.diagnostics import DiagnosticsScreen
|
from tui.screens.diagnostics import DiagnosticsScreen
|
||||||
|
|
||||||
app.push_screen(DiagnosticsScreen())
|
app.push_screen(DiagnosticsScreen())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from .gpu_detection import detect_gpu_devices
|
|
||||||
|
from utils.gpu_detection import detect_gpu_devices
|
||||||
from utils.logging_config import get_logger
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
logger = get_logger(__name__)
|
logger = get_logger(__name__)
|
||||||
|
|
@ -360,7 +361,7 @@ def process_document_sync(file_path: str):
|
||||||
system=f"{platform.system()} {platform.release()}",
|
system=f"{platform.system()} {platform.release()}",
|
||||||
architecture=platform.machine(),
|
architecture=platform.machine(),
|
||||||
)
|
)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Re-raise to trigger BrokenProcessPool in main process
|
# Re-raise to trigger BrokenProcessPool in main process
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ def configure_logging(
|
||||||
pathname = event_dict.pop("pathname", "")
|
pathname = event_dict.pop("pathname", "")
|
||||||
filename = event_dict.pop("filename", "")
|
filename = event_dict.pop("filename", "")
|
||||||
lineno = event_dict.pop("lineno", "")
|
lineno = event_dict.pop("lineno", "")
|
||||||
level = event_dict.pop("level", "")
|
_ = event_dict.pop("level", "")
|
||||||
|
|
||||||
# Build file location - prefer pathname for full path, fallback to filename
|
# Build file location - prefer pathname for full path, fallback to filename
|
||||||
if pathname and lineno:
|
if pathname and lineno:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
"""Telemetry module for OpenRAG backend."""
|
"""Telemetry module for OpenRAG backend."""
|
||||||
|
|
||||||
from .client import TelemetryClient
|
from utils.telemetry.category import Category
|
||||||
from .category import Category
|
from utils.telemetry.client import TelemetryClient
|
||||||
from .message_id import MessageId
|
from utils.telemetry.message_id import MessageId
|
||||||
|
|
||||||
__all__ = ["TelemetryClient", "Category", "MessageId"]
|
__all__ = ["TelemetryClient", "Category", "MessageId"]
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,9 @@ load_dotenv()
|
||||||
os.environ["GOOGLE_OAUTH_CLIENT_ID"] = ""
|
os.environ["GOOGLE_OAUTH_CLIENT_ID"] = ""
|
||||||
os.environ["GOOGLE_OAUTH_CLIENT_SECRET"] = ""
|
os.environ["GOOGLE_OAUTH_CLIENT_SECRET"] = ""
|
||||||
|
|
||||||
from src.config.settings import clients
|
from src.config.settings import clients # noqa: E402
|
||||||
from src.session_manager import SessionManager
|
from src.session_manager import SessionManager # noqa: E402
|
||||||
from src.main import generate_jwt_keys
|
from src.main import generate_jwt_keys # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
@pytest_asyncio.fixture(scope="session", autouse=True)
|
@pytest_asyncio.fixture(scope="session", autouse=True)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ src_path = os.path.join(repo_root, "src")
|
||||||
if src_path not in sys.path:
|
if src_path not in sys.path:
|
||||||
sys.path.insert(0, src_path)
|
sys.path.insert(0, src_path)
|
||||||
|
|
||||||
from utils.document_processing import create_document_converter
|
from utils.document_processing import create_document_converter # noqa: E402
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue