mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-04 12:58:42 +02:00
Add non-ee fallback to fetch_versioned_implementation
This commit is contained in:
@@ -25,5 +25,14 @@ global_version = DanswerVersion()
|
|||||||
@functools.lru_cache(maxsize=128)
|
@functools.lru_cache(maxsize=128)
|
||||||
def fetch_versioned_implementation(module: str, attribute: str) -> Any:
|
def fetch_versioned_implementation(module: str, attribute: str) -> Any:
|
||||||
logger.debug("Fetching versioned implementation for %s.%s", module, attribute)
|
logger.debug("Fetching versioned implementation for %s.%s", module, attribute)
|
||||||
module_full = f"ee.{module}" if global_version.get_is_ee_version() else module
|
is_ee = global_version.get_is_ee_version()
|
||||||
return getattr(importlib.import_module(module_full), attribute)
|
|
||||||
|
module_full = f"ee.{module}" if is_ee else module
|
||||||
|
try:
|
||||||
|
return getattr(importlib.import_module(module_full), attribute)
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
# try the non-ee version as a fallback
|
||||||
|
if is_ee:
|
||||||
|
return getattr(importlib.import_module(module), attribute)
|
||||||
|
|
||||||
|
raise
|
||||||
|
Reference in New Issue
Block a user