Skip to content

Commit

Permalink
Allow new interview features to be null or empty list.
Browse files Browse the repository at this point in the history
  • Loading branch information
Torantulino committed May 1, 2024
1 parent aefa8c2 commit e30f8d8
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions codex/interview/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,24 @@ def apply_feature_updates(
"""

try:
if update.features is None:
raise ValueError("No features found in the update")
if not isinstance(update.features, list):
raise TypeError("Expected features to be a list")
# if update.features is None:
# raise ValueError("No features found in the update")
# if not isinstance(update.features, list):
# raise TypeError("Expected features to be a list")
if not last_step.Features:
raise ValueError("No features found in the last step")

# If features is None or an empty list, return the existing features
if not update.features:
return [
prisma.types.FeatureCreateWithoutRelationsInput(
name=f.name,
reasoning=f.reasoning,
functionality=f.functionality,
)
for f in last_step.Features
]

update_map = {f.id: f for f in update.features if f.action == Action.UPDATE}
remove_set = {f.id for f in update.features if f.action == Action.REMOVE}

Expand Down

0 comments on commit e30f8d8

Please sign in to comment.