tofarr 21e912d6fb
Feat remove redis (#6278)
Co-authored-by: openhands <openhands@all-hands.dev>
2025-01-23 14:33:16 -07:00

38 lines
1.1 KiB
Python

import os
import socketio
from dotenv import load_dotenv
from openhands.core.config import load_app_config
from openhands.server.config.openhands_config import load_openhands_config
from openhands.server.conversation_manager.conversation_manager import (
ConversationManager,
)
from openhands.storage import get_file_store
from openhands.utils.import_utils import get_impl
load_dotenv()
config = load_app_config()
openhands_config = load_openhands_config()
file_store = get_file_store(config.file_store, 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
)
ConversationManagerImpl = get_impl(
ConversationManager, # type: ignore
openhands_config.conversation_manager_class,
)
conversation_manager = ConversationManagerImpl.get_instance(sio, config, file_store)