Skip to content

Commit

Permalink
Allow new interview features to be null or empty list. (#264)
Browse files Browse the repository at this point in the history
* Allow new interview features to be null or empty list.

* Remove commented code
  • Loading branch information
Torantulino authored May 1, 2024
1 parent aefa8c2 commit a02b523
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions codex/interview/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,20 @@ 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 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 a02b523

Please sign in to comment.