mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-04-29 03:00:45 -04:00
57 lines
2.4 KiB
Python
57 lines
2.4 KiB
Python
# IMPORTANT: LEGACY V0 CODE - Deprecated since version 1.0.0, scheduled for removal April 1, 2026
|
|
# This file is part of the legacy (V0) implementation of OpenHands and will be removed soon as we complete the migration to V1.
|
|
# OpenHands V1 uses the Software Agent SDK for the agentic core and runs a new application server. Please refer to:
|
|
# - V1 agentic core (SDK): https://github.com/OpenHands/software-agent-sdk
|
|
# - V1 application server (in this repo): openhands/app_server/
|
|
# Unless you are working on deprecation, please avoid extending this legacy file and consult the V1 codepaths above.
|
|
# Tag: Legacy-V0
|
|
# This module belongs to the old V0 web server. The V1 application server lives under openhands/app_server/.
|
|
import os
|
|
|
|
import socketio
|
|
from dotenv import load_dotenv
|
|
|
|
from openhands.app_server.secrets.secrets_store import SecretsStore
|
|
from openhands.app_server.settings.settings_store import SettingsStore
|
|
from openhands.core.config import load_openhands_config
|
|
from openhands.core.config.openhands_config import OpenHandsConfig
|
|
from openhands.server.config.server_config import ServerConfig, load_server_config
|
|
from openhands.server.types import ServerConfigInterface
|
|
from openhands.storage import get_file_store
|
|
from openhands.storage.files import FileStore
|
|
from openhands.utils.import_utils import get_impl
|
|
|
|
load_dotenv()
|
|
|
|
config: OpenHandsConfig = load_openhands_config()
|
|
server_config_interface: ServerConfigInterface = load_server_config()
|
|
assert isinstance(server_config_interface, ServerConfig), (
|
|
'Loaded server config interface is not a ServerConfig, despite this being assumed'
|
|
)
|
|
server_config: ServerConfig = server_config_interface
|
|
file_store: FileStore = get_file_store(
|
|
file_store_type=config.file_store,
|
|
file_store_path=config.file_store_path,
|
|
)
|
|
|
|
client_manager = None
|
|
redis_host = os.environ.get('REDIS_HOST')
|
|
if redis_host:
|
|
client_manager = socketio.AsyncRedisManager(
|
|
f'redis://{redis_host}',
|
|
redis_options={'password': os.environ.get('REDIS_PASSWORD')},
|
|
)
|
|
|
|
|
|
sio = socketio.AsyncServer(
|
|
async_mode='asgi',
|
|
cors_allowed_origins='*',
|
|
client_manager=client_manager,
|
|
# Increase buffer size to 4MB (to handle 3MB files with base64 overhead)
|
|
max_http_buffer_size=4 * 1024 * 1024,
|
|
)
|
|
|
|
SettingsStoreImpl = get_impl(SettingsStore, server_config.settings_store_class)
|
|
|
|
SecretsStoreImpl = get_impl(SecretsStore, server_config.secret_store_class)
|