script regeneration after ai fallback (#3330)
This commit is contained in:
@@ -1187,7 +1187,7 @@ async def generate_workflow_script(
|
||||
|
||||
|
||||
async def create_script_block(
|
||||
block_code: str,
|
||||
block_code: str | bytes,
|
||||
script_revision_id: str,
|
||||
script_id: str,
|
||||
organization_id: str,
|
||||
@@ -1205,6 +1205,7 @@ async def create_script_block(
|
||||
block_name: Optional custom name for the block (defaults to function name)
|
||||
block_description: Optional description for the block
|
||||
"""
|
||||
block_code_bytes = block_code if isinstance(block_code, bytes) else block_code.encode("utf-8")
|
||||
try:
|
||||
# Step 3: Create script block in database
|
||||
script_block = await app.DATABASE.create_script_block(
|
||||
@@ -1225,7 +1226,7 @@ async def create_script_block(
|
||||
script_id=script_id,
|
||||
script_version=1, # Assuming version 1 for now
|
||||
file_path=file_path,
|
||||
data=block_code.encode("utf-8"),
|
||||
data=block_code_bytes,
|
||||
)
|
||||
|
||||
# Create script file record
|
||||
@@ -1236,8 +1237,8 @@ async def create_script_block(
|
||||
file_path=file_path,
|
||||
file_name=file_name,
|
||||
file_type="file",
|
||||
content_hash=f"sha256:{hashlib.sha256(block_code.encode('utf-8')).hexdigest()}",
|
||||
file_size=len(block_code.encode("utf-8")),
|
||||
content_hash=f"sha256:{hashlib.sha256(block_code_bytes).hexdigest()}",
|
||||
file_size=len(block_code_bytes),
|
||||
mime_type="text/x-python",
|
||||
artifact_id=artifact_id,
|
||||
)
|
||||
|
||||
@@ -278,7 +278,6 @@ class SkyvernPage:
|
||||
If the prompt generation or parsing fails for any reason we fall back to
|
||||
clicking the originally supplied ``xpath``.
|
||||
"""
|
||||
|
||||
new_xpath = xpath
|
||||
|
||||
if intention and data:
|
||||
|
||||
Reference in New Issue
Block a user