Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend): Improve typing for blocks StepThroughItemsBlock, CountdownTimerBlock, AddToListBlock, AddToDictionaryBlock #8713

Conversation

majdyz
Copy link
Contributor

@majdyz majdyz commented Nov 19, 2024

This addresses #8679 & #8676

Some list & dictionary blocks mix the types with None or other types, making the input rendered as an any / free-text input field instead of proper array & key-value input.

image

Changes 🏗️

Improve typing for blocks StepThroughItemsBlock, CountdownTimerBlock, AddToListBlock, AddToDictionaryBlock

Checklist 📋

For code changes:

  • I have clearly listed my changes in the PR description
  • I have made a test plan
  • I have tested my changes according to the test plan:
    • ...
Example test plan
  • Create from scratch and execute an agent with at least 3 blocks
  • Import an agent from file upload, and confirm it executes correctly
  • Upload agent to marketplace
  • Import an agent from marketplace and confirm it executes correctly
  • Edit an agent from monitor, and confirm it executes correctly

For configuration changes:

  • .env.example is updated or already compatible with my changes
  • docker-compose.yml is updated or already compatible with my changes
  • I have included a list of my configuration changes in the PR description (under Changes)
Examples of configuration changes
  • Changing ports
  • Adding new services that need to communicate with each other
  • Secrets or environment variable changes
  • New or infrastructure changes such as databases

Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Code Duplication
The items, items_object and items_str fields in StepThroughItemsBlock seem to serve the same purpose with different types. Consider consolidating these into a single field that handles type conversion internally.

Potential Bug
The AddToListBlock's run method uses entries_added before checking if input_data.entry exists, which could lead to unexpected behavior if entry is None.

Copy link

netlify bot commented Nov 19, 2024

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 1e1c568
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/673cf9c6ae54fb0008d7b633

@majdyz majdyz enabled auto-merge (squash) November 19, 2024 20:49
@majdyz majdyz merged commit 274419d into dev Nov 19, 2024
14 checks passed
@majdyz majdyz deleted the zamilmajdy/open-2051-add-blocks-for-instantiating-dictionary-and-list-with-values branch November 19, 2024 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants