sync update from LAN repo (source ji @ 85078a31)
This commit is contained in:
1 parent
5d6627af50
commit
e602d88695
864 files changed
+99150
-6346
No files matched your search
+23
@@ -2,6 +2,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import lru_cache
|
||||
|
||||
import httpx
|
||||
|
||||
from deerflow.config import get_app_config
|
||||
@@ -37,9 +39,30 @@ def build_weknora_client(
|
||||
) -> WeKnoraClient:
|
||||
if not runtime.weknora_enabled:
|
||||
raise RuntimeError("WeKnora mode is not enabled")
|
||||
if http_client is None:
|
||||
return _shared_weknora_client(
|
||||
runtime.api_base_url,
|
||||
runtime.admin_email,
|
||||
runtime.admin_password,
|
||||
)
|
||||
return WeKnoraClient(
|
||||
base_url=runtime.api_base_url,
|
||||
http_client=http_client,
|
||||
admin_email=runtime.admin_email,
|
||||
admin_password=runtime.admin_password,
|
||||
)
|
||||
|
||||
|
||||
@lru_cache(maxsize=4)
|
||||
def _shared_weknora_client(
|
||||
base_url: str,
|
||||
admin_email: str,
|
||||
admin_password: str,
|
||||
) -> WeKnoraClient:
|
||||
"""Reuse auth state for equivalent runtime configurations."""
|
||||
|
||||
return WeKnoraClient(
|
||||
base_url=base_url,
|
||||
admin_email=admin_email,
|
||||
admin_password=admin_password,
|
||||
)
|
||||
Reference in new issue
Block a user