Files
AutoGPT/autogpt_platform/backend
Otto 7d9380a793 refactor(copilot): code cleanup - extract shared helpers and reduce duplication
WIP cleanup of AI Copilot code:

- Create util/validation.py with UUID validation helpers
- Create tools/helpers.py with shared utilities:
  - get_inputs_from_schema() for extracting input fields from JSON schema
  - error_response() for standardized error responses
  - format_inputs_as_markdown() for formatting inputs
- Add shared credential matching utilities to utils.py:
  - get_user_credentials() - fetch user's available credentials
  - find_matching_credential() - find a credential matching requirements
  - create_credential_meta_from_match() - create CredentialsMetaInput
  - match_credentials_to_requirements() - core matching logic
- Refactor match_user_credentials_to_graph() to use shared matching logic
- Refactor run_block._check_block_credentials() to use shared matching logic
- Update run_agent.py to use shared get_inputs_from_schema helper
- Update run_block.py to use shared get_inputs_from_schema helper
- Extract _create_stream_generator() in routes.py to eliminate duplicate event generators
- Extract SSE_RESPONSE_HEADERS constant

This reduces code duplication and improves maintainability.
2026-02-03 10:59:53 +00:00
..