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

feat(platform): Support multiple credentials inputs on blocks #8932

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from

Conversation

Pwuts
Copy link
Member

@Pwuts Pwuts commented Dec 10, 2024

Changes 🏗️

  • feat(platform): Support multiple credentials inputs on blocks

  • Update docs with info on multi credentials support

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:
    • ...

… `credentials` inputs

- Add `credentials_provider` and `credentials_types` to field schema from `CredentialsMetaInput` instead of `CredentialsField`
  - Remove `provider` and `supported_credential_types` params from `CredentialsField` and all its usages
  - Add `credentials` schema validation logic to `CredentialsMetaInput`, which is called from `BlockSchema.__pydantic_init_subclass__`
- Add missing providers to `ProviderName`
- Replace string literals for provider names with `ProviderName.{PROVIDER}` on blocks and in `CredentialsMetaInput`, `BlockWebhookConfig`, `*OAuthHandler`
- docs: Update instructions for blocks with authentication
@github-actions github-actions bot added documentation Improvements or additions to documentation platform/backend AutoGPT Platform - Back end platform/blocks size/xl labels Dec 10, 2024
Copy link

netlify bot commented Dec 10, 2024

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
🔨 Latest commit 1dfcadb
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs-dev/deploys/6759f186dc4ea30008ec8459

Copy link

netlify bot commented Dec 10, 2024

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 1dfcadb
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/6759f18661ec8a0008662bcb

@github-actions github-actions bot added the platform/frontend AutoGPT Platform - Front end label Dec 10, 2024
@Pwuts Pwuts marked this pull request as ready for review December 11, 2024 11:44
@Pwuts Pwuts requested a review from a team as a code owner December 11, 2024 11:44
@Pwuts Pwuts requested review from ntindle, Swiftyos, aarushik93 and kcze and removed request for a team and Swiftyos December 11, 2024 11:44
@Pwuts Pwuts changed the base branch from dev to reinier/make-providername-enum December 11, 2024 11:48
@github-actions github-actions bot added size/l and removed size/xl labels Dec 11, 2024
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Dec 11, 2024
…support-multiple-provider-credentials-inputs
Copy link
Contributor

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

@github-actions github-actions bot removed the conflicts Automatically applied to PRs with merge conflicts label Dec 11, 2024
@Pwuts
Copy link
Member Author

Pwuts commented Dec 11, 2024

@aarushik93 could you branch from this PR and see if it works for you? I currently have no blocks to test it on.

Base automatically changed from reinier/make-providername-enum to dev December 11, 2024 19:56
@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Dec 11, 2024
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@github-actions github-actions bot removed the conflicts Automatically applied to PRs with merge conflicts label Dec 11, 2024
Copy link
Contributor

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

@@ -256,7 +257,8 @@ export function CustomNode({
side="left"
/>
) : (
propKey != "credentials" && (
propKey != "credentials" &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
propKey != "credentials" &&
propKey !== "credentials" &&

extra_exec_kwargs[field_name] = block.test_credentials
elif credentials_input_fields and block.test_credentials:
if not isinstance(block.test_credentials, dict):
log.warning(f"Block {block.name} has no usable test credentials")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not raise? It's a test, shouldn't it fail?

f"Node #{node.id} referenced non-existent "
f"credentials #{creds_meta['id']}"
if (
# Webhook-triggered blocks are only allowed to have 1 credentials input
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? Won't we end up like now where we need multiple?

Copy link
Contributor

@aarushik93 aarushik93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than @kcze coments looks good

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Dec 18, 2024
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Automatically applied to PRs with merge conflicts documentation Improvements or additions to documentation platform/backend AutoGPT Platform - Back end platform/frontend AutoGPT Platform - Front end size/l
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants