fix: move ServerEnv import to module level for use in business logic functions

ServerEnv was imported inside load_hermes_web_cli() but used by all
other functions (get_all_services, create_service, etc.), causing
'ServerEnv is not defined' NameError at runtime.
This commit is contained in:
yumoqing 2026-04-27 12:08:07 +08:00
parent 715d7d3952
commit 361969a34f

View File

@ -18,6 +18,7 @@ from datetime import datetime
# Import sqlor database module # Import sqlor database module
from sqlor.dbpools import get_sor_context, DBPools from sqlor.dbpools import get_sor_context, DBPools
from ahserver.serverenv import ServerEnv
# Import database table definitions and CRUD operations # Import database table definitions and CRUD operations
from .db_tables import TABLE_DEFINITIONS from .db_tables import TABLE_DEFINITIONS
@ -30,8 +31,6 @@ def load_hermes_web_cli():
It registers all module functions with the ServerEnv instance It registers all module functions with the ServerEnv instance
so they can be called directly from .ui and .dspy files. so they can be called directly from .ui and .dspy files.
""" """
from ahserver.serverenv import ServerEnv
# Get the ServerEnv instance # Get the ServerEnv instance
env = ServerEnv() env = ServerEnv()