mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Fix for issues where callbacks are not batched (#10235)
This commit is contained in:
parent
af49b615b1
commit
6f21b6700a
@ -27,11 +27,11 @@ assert isinstance(server_config_interface, ServerConfig), (
|
||||
)
|
||||
server_config: ServerConfig = server_config_interface
|
||||
file_store: FileStore = get_file_store(
|
||||
config.file_store,
|
||||
config.file_store_path,
|
||||
config.file_store_web_hook_url,
|
||||
config.file_store_web_hook_headers,
|
||||
batch=config.file_store_web_hook_batch,
|
||||
file_store_type=config.file_store,
|
||||
file_store_path=config.file_store_path,
|
||||
file_store_web_hook_url=config.file_store_web_hook_url,
|
||||
file_store_web_hook_headers=config.file_store_web_hook_headers,
|
||||
file_store_web_hook_batch=config.file_store_web_hook_batch,
|
||||
)
|
||||
|
||||
client_manager = None
|
||||
|
||||
@ -16,7 +16,7 @@ def get_file_store(
|
||||
file_store_path: str | None = None,
|
||||
file_store_web_hook_url: str | None = None,
|
||||
file_store_web_hook_headers: dict | None = None,
|
||||
batch: bool = False,
|
||||
file_store_web_hook_batch: bool = False,
|
||||
) -> FileStore:
|
||||
store: FileStore
|
||||
if file_store_type == 'local':
|
||||
@ -40,7 +40,7 @@ def get_file_store(
|
||||
|
||||
client = httpx.Client(headers=file_store_web_hook_headers or {})
|
||||
|
||||
if batch:
|
||||
if file_store_web_hook_batch:
|
||||
# Use batched webhook file store
|
||||
store = BatchedWebHookFileStore(
|
||||
store,
|
||||
|
||||
@ -106,10 +106,11 @@ class FileConversationStore(ConversationStore):
|
||||
cls, config: OpenHandsConfig, user_id: str | None
|
||||
) -> FileConversationStore:
|
||||
file_store = get_file_store(
|
||||
config.file_store,
|
||||
config.file_store_path,
|
||||
config.file_store_web_hook_url,
|
||||
config.file_store_web_hook_headers,
|
||||
file_store_type=config.file_store,
|
||||
file_store_path=config.file_store_path,
|
||||
file_store_web_hook_url=config.file_store_web_hook_url,
|
||||
file_store_web_hook_headers=config.file_store_web_hook_headers,
|
||||
file_store_web_hook_batch=config.file_store_web_hook_batch,
|
||||
)
|
||||
return FileConversationStore(file_store)
|
||||
|
||||
|
||||
@ -40,9 +40,10 @@ class FileSecretsStore(SecretsStore):
|
||||
cls, config: OpenHandsConfig, user_id: str | None
|
||||
) -> FileSecretsStore:
|
||||
file_store = get_file_store(
|
||||
config.file_store,
|
||||
config.file_store_path,
|
||||
config.file_store_web_hook_url,
|
||||
config.file_store_web_hook_headers,
|
||||
file_store_type=config.file_store,
|
||||
file_store_path=config.file_store_path,
|
||||
file_store_web_hook_url=config.file_store_web_hook_url,
|
||||
file_store_web_hook_headers=config.file_store_web_hook_headers,
|
||||
file_store_web_hook_batch=config.file_store_web_hook_batch,
|
||||
)
|
||||
return FileSecretsStore(file_store)
|
||||
|
||||
@ -34,9 +34,10 @@ class FileSettingsStore(SettingsStore):
|
||||
cls, config: OpenHandsConfig, user_id: str | None
|
||||
) -> FileSettingsStore:
|
||||
file_store = get_file_store(
|
||||
config.file_store,
|
||||
config.file_store_path,
|
||||
config.file_store_web_hook_url,
|
||||
config.file_store_web_hook_headers,
|
||||
file_store_type=config.file_store,
|
||||
file_store_path=config.file_store_path,
|
||||
file_store_web_hook_url=config.file_store_web_hook_url,
|
||||
file_store_web_hook_headers=config.file_store_web_hook_headers,
|
||||
file_store_web_hook_batch=config.file_store_web_hook_batch,
|
||||
)
|
||||
return FileSettingsStore(file_store)
|
||||
|
||||
@ -260,10 +260,11 @@ def _load_runtime(
|
||||
config.mcp = override_mcp_config
|
||||
|
||||
file_store = file_store = get_file_store(
|
||||
config.file_store,
|
||||
config.file_store_path,
|
||||
config.file_store_web_hook_url,
|
||||
config.file_store_web_hook_headers,
|
||||
file_store_type=config.file_store,
|
||||
file_store_path=config.file_store_path,
|
||||
file_store_web_hook_url=config.file_store_web_hook_url,
|
||||
file_store_web_hook_headers=config.file_store_web_hook_headers,
|
||||
file_store_web_hook_batch=config.file_store_web_hook_batch,
|
||||
)
|
||||
event_stream = EventStream(sid, file_store)
|
||||
|
||||
|
||||
@ -86,4 +86,10 @@ async def test_get_instance():
|
||||
|
||||
assert isinstance(store, FileSettingsStore)
|
||||
assert store.file_store == mock_store
|
||||
mock_get_store.assert_called_once_with('local', '/test/path', None, None)
|
||||
mock_get_store.assert_called_once_with(
|
||||
file_store_type='local',
|
||||
file_store_path='/test/path',
|
||||
file_store_web_hook_url=None,
|
||||
file_store_web_hook_headers=None,
|
||||
file_store_web_hook_batch=False,
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user