mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
Feat: Better mechanism for attaching middleware (#6365)
This commit is contained in:
@@ -2,6 +2,8 @@ from abc import ABC, abstractmethod
|
||||
from enum import Enum
|
||||
from typing import ClassVar, Protocol
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
|
||||
class AppMode(Enum):
|
||||
OSS = 'oss'
|
||||
@@ -36,6 +38,11 @@ class OpenhandsConfigInterface(ABC):
|
||||
"""Configure attributes for frontend"""
|
||||
raise NotImplementedError
|
||||
|
||||
@abstractmethod
|
||||
def attach_middleware(self, api: FastAPI) -> None:
|
||||
"""Attach required middleware for the current environment"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class MissingSettingsError(ValueError):
|
||||
"""Raised when settings are missing or not found."""
|
||||
|
||||
Reference in New Issue
Block a user