MCPcopy
hub / github.com/Open-LLM-VTuber/Open-LLM-VTuber / run

Function run

run_server.py:120–164  ·  view source on GitHub ↗
(console_log_level: str)

Source from the content-addressed store, hash-verified

118
119@logger.catch
120def run(console_log_level: str):
121 init_logger(console_log_level)
122 logger.info(f"Open-LLM-VTuber, version v{get_version()}")
123
124 # Get selected language
125 lang = upgrade_manager.lang
126
127 # Check if the frontend submodule is initialized
128 check_frontend_submodule(lang)
129
130 # Sync user config with default config
131 try:
132 upgrade_manager.sync_user_config()
133 except Exception as e:
134 logger.error(f"Error syncing user config: {e}")
135
136 atexit.register(WebSocketServer.clean_cache)
137
138 # Load configurations from yaml file
139 config: Config = validate_config(read_yaml("conf.yaml"))
140 server_config = config.system_config
141
142 if server_config.enable_proxy:
143 logger.info("Proxy mode enabled - /proxy-ws endpoint will be available")
144
145 # Initialize the WebSocket server (synchronous part)
146 server = WebSocketServer(config=config)
147
148 # Perform asynchronous initialization (loading context, etc.)
149 logger.info("Initializing server context...")
150 try:
151 asyncio.run(server.initialize())
152 logger.info("Server context initialized successfully.")
153 except Exception as e:
154 logger.error(f"Failed to initialize server context: {e}")
155 sys.exit(1) # Exit if initialization fails
156
157 # Run the Uvicorn server
158 logger.info(f"Starting server on {server_config.host}:{server_config.port}")
159 uvicorn.run(
160 app=server.app,
161 host=server_config.host,
162 port=server_config.port,
163 log_level=console_log_level.lower(),
164 )
165
166
167if __name__ == "__main__":

Callers 1

run_server.pyFile · 0.85

Calls 9

initializeMethod · 0.95
validate_configFunction · 0.90
read_yamlFunction · 0.90
WebSocketServerClass · 0.90
init_loggerFunction · 0.85
get_versionFunction · 0.85
check_frontend_submoduleFunction · 0.85
sync_user_configMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected