Screen streaming under docker environment (#674)
Co-authored-by: Shuchang Zheng <wintonzheng0325@gmail.com>
This commit is contained in:
@@ -51,3 +51,11 @@ class BaseStorage(ABC):
|
||||
@abstractmethod
|
||||
async def store_artifact_from_path(self, artifact: Artifact, path: str) -> None:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def save_streaming_file(self, organization_id: str, file_name: str) -> None:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def get_streaming_file(self, organization_id: str, file_name: str, use_default: bool = True) -> bytes | None:
|
||||
pass
|
||||
|
||||
@@ -67,6 +67,24 @@ class LocalStorage(BaseStorage):
|
||||
async def get_share_links(self, artifacts: list[Artifact]) -> list[str]:
|
||||
return [artifact.uri for artifact in artifacts]
|
||||
|
||||
async def save_streaming_file(self, organization_id: str, file_name: str) -> None:
|
||||
return
|
||||
|
||||
async def get_streaming_file(self, organization_id: str, file_name: str, use_default: bool = True) -> bytes | None:
|
||||
file_path = Path(f"{SettingsManager.get_settings().STREAMING_FILE_BASE_PATH}/skyvern_screenshot.png")
|
||||
if not use_default:
|
||||
file_path = Path(f"{SettingsManager.get_settings().STREAMING_FILE_BASE_PATH}/{organization_id}/{file_name}")
|
||||
try:
|
||||
with open(file_path, "rb") as f:
|
||||
return f.read()
|
||||
except Exception:
|
||||
LOG.exception(
|
||||
"Failed to retrieve streaming file.",
|
||||
organization_id=organization_id,
|
||||
file_name=file_name,
|
||||
)
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _parse_uri_to_path(uri: str) -> str:
|
||||
parsed_uri = urlparse(uri)
|
||||
|
||||
Reference in New Issue
Block a user