CoolFace
Apppublic

Backup-bdg/OpenHands

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes
types.py45 linesDownload Raw Back to server
1from abc import ABC, abstractmethod2from enum import Enum3from typing import Any, ClassVar, Protocol4 5 6class AppMode(Enum):7    OSS = 'oss'8    SAAS = 'saas'9 10 11class SessionMiddlewareInterface(Protocol):12    """Protocol for session middleware classes."""13 14    pass15 16 17class ServerConfigInterface(ABC):18    CONFIG_PATH: ClassVar[str | None]19    APP_MODE: ClassVar[AppMode]20    POSTHOG_CLIENT_KEY: ClassVar[str]21    GITHUB_CLIENT_ID: ClassVar[str]22    ATTACH_SESSION_MIDDLEWARE_PATH: ClassVar[str]23 24    @abstractmethod25    def verify_config(self) -> None:26        """Verify configuration settings."""27        raise NotImplementedError28 29    @abstractmethod30    def get_config(self) -> dict[str, Any]:31        """Configure attributes for frontend"""32        raise NotImplementedError33 34 35class MissingSettingsError(ValueError):36    """Raised when settings are missing or not found."""37 38    pass39 40 41class LLMAuthenticationError(ValueError):42    """Raised when there is an issue with LLM authentication."""43 44    pass45