use skyvern temp to save tempfiles (#1262)

This commit is contained in:
LawyZheng 2024-11-26 12:27:58 +08:00 committed by GitHub
parent 6b417d0e83
commit af25aeed77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 50 additions and 17 deletions

View file

@ -6,6 +6,7 @@ from urllib.parse import unquote, urlparse
import structlog
from skyvern.forge.sdk.api.files import get_skyvern_temp_dir
from skyvern.forge.sdk.artifact.models import Artifact, ArtifactType
from skyvern.forge.sdk.artifact.storage.base import FILE_EXTENTSION_MAP, BaseStorage
from skyvern.forge.sdk.models import Step
@ -73,9 +74,9 @@ class LocalStorage(BaseStorage):
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")
file_path = Path(f"{get_skyvern_temp_dir()}/skyvern_screenshot.png")
if not use_default:
file_path = Path(f"{SettingsManager.get_settings().STREAMING_FILE_BASE_PATH}/{organization_id}/{file_name}")
file_path = Path(f"{get_skyvern_temp_dir()}/{organization_id}/{file_name}")
try:
with open(file_path, "rb") as f:
return f.read()