refactor(sandbox): update sandbox service to use sandbox_id instead of workflow_execution_id

- Modified the SandboxService and related app generators to replace workflow_execution_id with sandbox_id for improved clarity and consistency in sandbox handling.
- Adjusted the AdvancedChatAppGenerator and WorkflowAppGenerator to align with the new parameter naming convention.
This commit is contained in:
Harry
2026-01-30 22:44:41 +08:00
parent bb4dd85ae3
commit b67d0d8c45
3 changed files with 4 additions and 8 deletions

View File

@ -536,13 +536,11 @@ class AdvancedChatAppGenerator(MessageBasedAppGenerator):
sandbox_provider=sandbox_provider,
)
else:
if application_generate_entity.workflow_run_id is None:
raise ValueError("workflow_run_id is required when sandbox is enabled")
sandbox = SandboxService.create(
tenant_id=application_generate_entity.app_config.tenant_id,
app_id=application_generate_entity.app_config.app_id,
user_id=application_generate_entity.user_id,
workflow_execution_id=application_generate_entity.workflow_run_id,
sandbox_id=conversation_id,
sandbox_provider=sandbox_provider,
)
graph_engine_layers = (SandboxLayer(sandbox=sandbox),)

View File

@ -515,7 +515,7 @@ class WorkflowAppGenerator(BaseAppGenerator):
tenant_id=application_generate_entity.app_config.tenant_id,
app_id=application_generate_entity.app_config.app_id,
user_id=application_generate_entity.user_id,
workflow_execution_id=application_generate_entity.workflow_execution_id,
sandbox_id=application_generate_entity.workflow_execution_id,
sandbox_provider=sandbox_provider,
)
graph_engine_layers = (

View File

@ -24,14 +24,14 @@ class SandboxService:
tenant_id: str,
app_id: str,
user_id: str,
workflow_execution_id: str,
sandbox_id: str,
sandbox_provider: SandboxProviderEntity,
) -> Sandbox:
assets = AppAssetService.get_assets(tenant_id, app_id, user_id, is_draft=False)
if not assets:
raise ValueError(f"No assets found for tid={tenant_id}, app_id={app_id}")
archive_storage = ArchiveSandboxStorage(tenant_id, app_id, workflow_execution_id, storage.storage_runner)
archive_storage = ArchiveSandboxStorage(tenant_id, app_id, sandbox_id, storage.storage_runner)
sandbox = (
SandboxBuilder(tenant_id, SandboxType(sandbox_provider.provider_type))
.options(sandbox_provider.config)
@ -67,8 +67,6 @@ class SandboxService:
if not assets:
raise ValueError(f"No assets found for tid={tenant_id}, app_id={app_id}")
SandboxService.delete_draft_storage(tenant_id, app_id, user_id)
AppAssetPackageService.build_assets(tenant_id, app_id, assets)
sandbox_id = SandboxBuilder.draft_id(user_id)
archive_storage = ArchiveSandboxStorage(