Commit Graph

696 Commits

Author SHA1 Message Date
Harry 641b27e76a chore: bump version to 0.6.0b2 in pyproject.toml and update requirements
- Updated the version of the dify_plugin from 0.6.0b1 to 0.6.0b2 in pyproject.toml.
- Adjusted the requirements.txt file to reflect the new plugin version.

These changes ensure that the project dependencies are aligned with the latest plugin version.
2025-09-29 19:00:01 +08:00
Harry 46b1ef471a refactor: streamline GitHub issue trigger implementation
- Removed the deprecated IssuesTrigger class and replaced it with a more focused IssueOpenedTrigger class to handle specific events when a new issue is opened.
- Updated the GitHub trigger YAML configuration to reflect changes in the subscription schema and parameters.
- Enhanced the validation logic for issue parameters, including title patterns, labels, assignees, authors, milestones, and body content.
- Improved the overall structure and clarity of the trigger implementation, ensuring better maintainability and functionality.

These changes contribute to a more efficient and organized handling of GitHub issue events, enhancing the plugin's responsiveness to user interactions.
2025-09-29 18:31:39 +08:00
Harry d75f734b7d feat: add checkbox parameter type to provider configuration
- Introduced a new CHECKBOX type in CommonParameterType to enhance parameter options.
- Updated ToolParameter and TriggerParameter classes to include the new CHECKBOX type.
- Modified the GitHub trigger manifest version to 1.1.0 and changed parameter type from select to checkbox in issues.yaml.

These changes improve the flexibility of parameter types available in the plugin, allowing for more diverse user interactions.
2025-09-29 14:29:38 +08:00
Yeuoly 64244dc603 refactor: enhance test structure for TriggerProvider and TriggerSubscriptionConstructor
- Introduced TriggerProviderImpl and TriggerSubscriptionConstructor implementations in test_construct_trigger_provider.py to facilitate testing.
- Updated session management and request/response handling for improved test clarity and functionality.
- Ensured that the tests validate the behavior of the TriggerProvider and TriggerSubscriptionConstructor interfaces effectively.

These changes contribute to a more robust and maintainable testing framework for trigger functionality.
2025-09-26 23:30:19 +08:00
Yeuoly e8d4949f0b refactor: simplify trigger implementation in tests
- Removed the TriggerRuntime dependency from the test_construct_trigger.py file, streamlining the trigger instantiation process.
- Adjusted imports to reflect the updated structure, enhancing code clarity.

These changes contribute to a cleaner and more maintainable test setup for the trigger functionality.
2025-09-26 23:25:43 +08:00
Yeuoly 420b2b6db1 refactor: improve code readability and organization
- Adjusted import order in request.py for consistency.
- Enhanced the description formatting in trigger.py for better clarity.
- Streamlined exception handling and method signatures in github.py for improved readability.
- Simplified dictionary construction in message_delivered.py to enhance clarity.
- Consolidated return statements in test_trigger_factory.py for better organization.

These changes contribute to a cleaner and more maintainable codebase, improving overall readability and consistency across the project.
2025-09-26 23:23:38 +08:00
Yeuoly 8d83234b83 fix: update GitHub trigger plugin configuration
- Removed the MAX_REQUEST_TIMEOUT parameter from the Plugin initialization for default behavior.
- Added a new section in the GitHub provider YAML file to specify the source of the Python implementation.

These changes simplify the plugin setup and enhance the configuration clarity for the GitHub trigger integration.
2025-09-26 23:17:40 +08:00
Yeuoly 1881a22494 refactor: streamline trigger factory and enhance plugin registration
- Consolidated logic in PluginRegistration for determining subscription constructor classes.
- Simplified method signatures in TriggerFactory for better readability.
- Updated import paths in providers.py to reflect the new module structure.
- Introduced comprehensive tests for the TriggerFactory to ensure robust functionality.

These changes improve code clarity and maintainability while enhancing the overall structure of the trigger management system.
2025-09-26 23:14:03 +08:00
Yeuoly 3254019ec6 Add documentation and tests for trigger factory (#212) 2025-09-26 23:08:29 +08:00
Chieh Wang e2f6d0452a feat: support ja (#195) 2025-09-26 22:51:43 +08:00
Yeuoly fac16a49d2 feat: enhance trigger subscription management and introduce new runtime classes
- Added TriggerSubscriptionConstructorRuntime for managing subscription credentials and session data.
- Refactored PluginExecutor to utilize the new trigger subscription constructor for improved event handling.
- Updated PluginRegistration to support the new trigger subscription constructor interface.
- Introduced example-lark-trigger dependency in pyproject.toml for enhanced functionality.
- Cleaned up and standardized trigger-related classes and interfaces for better maintainability.

These changes improve the overall structure and functionality of the trigger subscription system, ensuring a more robust and flexible event handling process.
2025-09-26 22:20:23 +08:00
Yeuoly 76d1820205 feat: introduce UnsubscribeError for improved error handling in GitHub provider
- Added UnsubscribeError class to handle errors during unsubscribe operations, providing detailed error messages and codes.
- Updated GithubProvider to raise UnsubscribeError in various failure scenarios, enhancing error reporting and debugging.
- Minor adjustments in the IssuesTrigger class to prepare for future enhancements.

These changes improve the robustness of the GitHub trigger integration by ensuring clearer error management during webhook unsubscription processes.
2025-09-26 20:15:04 +08:00
Yeuoly 3adbc5c291 refactor: rename Unsubscription class to UnsubscribeResult for clarity
- Updated the class name from Unsubscription to UnsubscribeResult to better reflect its purpose.
- Adjusted related type hints and return types in the TriggerProvider interface and example implementations to maintain consistency.

These changes enhance code readability and improve the understanding of the unsubscription process in the trigger system.
2025-09-26 20:08:29 +08:00
Harry d3708859c7 refactor: remove DatasourceProviderMapping class from plugin_registration.py
- Eliminated the DatasourceProviderMapping class to streamline the codebase.
- This change enhances maintainability by reducing complexity in the plugin registration module.
2025-09-26 14:37:46 +08:00
Harry 5976f6ec1f refactor: format PluginAccessAction for improved readability
- Reformatted the definition of PluginAccessAction to enhance code clarity.
- Removed an unnecessary blank line in the TriggerInvokeRequest class.

These changes contribute to better code organization and maintainability.
2025-09-26 14:31:49 +08:00
Harry 27fca1f2fe feat: add DatasourceActions to PluginAccessAction and clean up code
- Included DatasourceActions in the merged PluginAccessAction for enhanced access control.
- Added a blank line for improved readability in the TriggerInvokeRequest class.

These changes improve the structure and functionality of the plugin request handling.
2025-09-26 14:21:33 +08:00
Harry 26b1324c59 Merge remote-tracking branch 'origin/main' into feat/trigger
# Conflicts:
#	python/dify_plugin/core/entities/message.py
#	python/dify_plugin/core/entities/plugin/request.py
#	python/dify_plugin/core/entities/plugin/setup.py
#	python/dify_plugin/core/plugin_registration.py
#	python/dify_plugin/plugin.py
#	python/examples/github/tools/github_repositories.yaml
#	python/pyproject.toml
2025-09-26 14:18:06 +08:00
He Wang 5f69350b7c fix: use dict.get() to avoid KeyError when transforming llm response (#209) 2025-09-26 13:17:32 +08:00
Rick b96f493563 feat: add max_invocation_timeout parameter (#208)
* feat: add max_invocation_timeout parameter

* style: format MAX_INVOCATION_TIMEOUT description for better readability

---------

Co-authored-by: Bytechoreographer <bytechoreographer@gmail.com>
2025-09-26 13:14:02 +08:00
Harry ebe4c89bea feat(github_trigger): enhance GitHub trigger functionality and update configurations
- Updated type hints in `setup.py` and `__init__.py` for better clarity and compatibility with newer Python versions.
- Improved descriptions in `trigger.py` for better understanding of output variables.
- Added new dynamic options fetching for repositories in `github.py`, enhancing user experience.
- Updated `manifest.yaml` to reflect the new version 100.1.1 and included additional localization for Japanese.
- Cleaned up and standardized code in various files for improved readability and maintainability.

These changes enhance the overall functionality and usability of the GitHub trigger integration, ensuring a more robust event handling process.
2025-09-25 17:20:16 +08:00
Harry 65da31647c feat(github_trigger): remove deprecated trigger files and add new issue trigger
- Deleted obsolete trigger files for various GitHub events including commit comments, create, delete, deployment, discussion, and others to streamline the trigger set.
- Introduced a new `issues.py` trigger to handle GitHub issue events, enhancing event handling capabilities.
- Added corresponding `issues.yaml` configuration to define the new trigger's properties and behavior.

These changes improve the overall functionality and maintainability of the GitHub trigger integration, ensuring a more efficient event handling process.
2025-09-25 17:18:29 +08:00
Harry 64d1f8fdde refactor: update type hints and improve error handling in datasource examples 2025-09-24 14:48:36 +08:00
Harry 4821ef2552 feat: add datasource plugin examples 2025-09-24 14:34:21 +08:00
Maries 2a5d34cd8f Merge pull request #149 from langgenius/feat/datasource
feat[0.5.0]: datasource
2025-09-24 11:33:48 +08:00
Harry 736d178485 feat(github_trigger): update trigger configurations and remove deprecated files
- Added a new trigger configuration for `pull_request_merged.yaml` to enhance event handling.
- Updated the `deployment_status_created.py` to return event variables correctly.
- Expanded the `deployment_status_created.yaml` with additional properties for better event context.
- Removed obsolete trigger files related to discussions and issues, streamlining the trigger set.

These changes improve the overall functionality and maintainability of the GitHub trigger integration.
2025-09-19 17:22:49 +08:00
Harry 897e45aa19 feat(whatsapp_trigger): add WhatsApp Business integration with message triggers
- Introduced a new plugin for WhatsApp Business that integrates webhook triggers for automated messaging workflows.
- Implemented triggers for text, image, and message delivery events, allowing users to respond to various message types.
- Added dynamic options fetching for available phone numbers and message templates.
- Included comprehensive documentation in README.md and manifest.yaml for setup and usage instructions.
- Enhanced security with signature validation for incoming webhook requests.

These additions provide a robust framework for automating interactions via WhatsApp, improving user engagement and operational efficiency.
2025-09-19 14:55:31 +08:00
Harry c67ef57f10 feat(trigger): introduce new error class and enhance event payload handling
- Added `TriggerIgnoreEventError` to handle cases where events should be ignored based on filter criteria.
- Updated various GitHub trigger files to return relevant payload fields directly, improving data accessibility for event handling.
- Enhanced the handling of event filtering in triggers to ensure only relevant events are processed.

These changes improve the robustness and clarity of the GitHub trigger integration, allowing for better error management and data handling.
2025-09-19 13:17:59 +08:00
ZalterCitty 9f4ec08d62 support invoke tool with app_id (#207) 2025-09-18 14:43:52 +08:00
Harry 04b6a5f36b chore: bump version to 0.5.0 2025-09-18 13:07:59 +08:00
Harry fe397eaa9f Merge remote-tracking branch 'origin/main' into feat/datasource 2025-09-18 13:06:53 +08:00
Harry d6f3ee7fae feat(provider): add 'multiple' field to ProviderConfig for enhanced configuration options
- Introduced a new boolean field 'multiple' in the ProviderConfig class to allow for more flexible configuration settings.

This addition improves the configurability of provider options within the plugin.
2025-09-17 22:24:09 +08:00
Harry b182fd2668 feat(trigger): enhance GitHub trigger event handling and update version
- Refactored `TriggerInvokeResponse` to use `Mapping[str, Any]` for event representation.
- Renamed `properties` to `variables` in the `Event` class for clarity and updated the description accordingly.
- Expanded the event options in the GitHub trigger configuration to allow selection of all events.
- Removed the deprecated `issue_comment` trigger implementation and its associated files.
- Bumped version in `manifest.yaml` to 0.0.9 to reflect these changes.

These updates improve the flexibility and clarity of the GitHub trigger integration, allowing for a broader range of event handling.
2025-09-17 13:46:04 +08:00
immortal-wm 2fc9753673 fix: corrected latency accuracy (#189)
* fix latency calc

* feat: add timing context management to AIModel for latency tracking

- Introduced a new TimingContextRaceConditionError to handle race conditions in multi-threaded environments.
- Implemented a timing_context method in AIModel to track request timing and prevent concurrent usage.
- Updated various model classes (LargeLanguageModel, ModerationModel, RerankModel, Speech2TextModel, TextEmbeddingModel, TTSModel) to utilize the new timing context for latency calculations.
- Added tests to validate timing context behavior under concurrent and sequential usage scenarios.

* feat: implement ModelFactory for dynamic model instance creation

- Added ModelFactory class to generate stateless model instances based on provider configurations and model classes.
- Updated PluginRegistration to utilize ModelFactory for managing model instances, enhancing code organization and maintainability.

* feat: add unit tests for model registry and mock model provider

- Introduced a new test file for validating model registry functionality.
- Implemented mock classes for model provider and LLM to facilitate testing.
- Added tests to ensure correct model instance retrieval from the registry.

* apply ruff

---------

Co-authored-by: Yeuoly <admin@srmxy.cn>
2025-09-16 16:15:20 +08:00
Yeuoly d53cea4093 Merge branch 'main' into feat/datasource 2025-09-09 16:50:29 +08:00
Harry 34cf20564b fix(test): update test case for oauth_get_authorization_url to include redirect URI
- Modified the test for `oauth_get_authorization_url` to pass a redirect URI as the first argument, ensuring proper functionality and coverage.

This change enhances the accuracy of the test case for the TriggerProvider's OAuth implementation.
2025-09-09 00:03:14 +08:00
Harry 482c227b88 refactor: standardize import statements in GitHub trigger files
- Removed redundant import paths for `fetch_repositories` in `github.py` and `issue_comment.py`.
- Updated import statements to use a consistent module path for better maintainability.

These changes enhance code organization and readability across the GitHub trigger implementation.
2025-09-08 23:55:31 +08:00
Harry a285c70f52 refactor: clean up imports and improve code readability
- Removed unused imports in `__init__.py` and `dynamic_options.py`.
- Consolidated import statements in `github.py` and `issue_comment.py` for better organization.
- Standardized string formatting in test cases for consistency.
- Enhanced overall code clarity and maintainability.

These changes contribute to a cleaner codebase and improved readability across the project.
2025-09-08 23:55:31 +08:00
Maries 4ba92c11f9 Merge branch 'main' into feat/trigger 2025-09-08 23:50:30 +08:00
Harry a04bdfdcf7 chore: bump dify_plugin version to 0.6.0b1 in pyproject.toml and requirements.txt 2025-09-08 23:49:20 +08:00
Harry 79992502b7 chore: bump dify_plugin version to 0.4.5b3 in requirements.txt 2025-09-08 23:43:34 +08:00
Harry b60bc8720d chore: bump version to 0.4.5b3 in pyproject.toml 2025-09-08 23:43:05 +08:00
Harry 22f156e9b2 feat(trigger): enhance GitHub trigger with multiple event selection and dynamic parameter options
- Updated `IssueCommentTrigger` and `GithubProvider` to support multiple event selections for GitHub triggers.
- Introduced a new `multiple` field in the trigger parameters to allow users to select multiple events.
- Implemented dynamic fetching of repository options based on OAuth credentials.
- Bumped version in `manifest.yaml` to 0.0.7 to reflect these enhancements.

This update improves the flexibility and usability of the GitHub trigger integration.
2025-09-08 23:42:33 +08:00
Yeuoly 5687c6f969 bump to 0.4.5 (#204) 2025-09-08 23:32:48 +08:00
Harry 4ba395f80a chore: update GitHub provider to support additional OAuth scopes and improve payload handling
- Bumped version in manifest.yaml to 0.0.5.
- Enhanced OAuth credential retrieval to include the 'admin:repo_hook' scope.
- Improved payload parsing logic for better handling of incoming requests.
- Adjusted default event in provider configuration for clarity.
2025-09-08 18:30:35 +08:00
QuantumGhost 005d05bc36 feat(python): relaxing version verification (#202)
Relaxing the verification for `PluginConfiguration.version`
and `PluginConfiguration.Meta.minimum_dify_version`.

SDK part of langgenius/dify#25160
2025-09-08 15:25:00 +08:00
deniswen 6b1d99fb62 fix: resolve 100% CPU usage in stdio buffer by replacing O(n²) Byte concatenation with BytesIO (#201)
* fix: improve stream reading and buffering logic

* fix: Re-add accidentally deleted line

---------

Co-authored-by: deniswen <denis.wen@anker-in.com>
2025-09-08 15:23:41 +08:00
Harry 7d46f19c92 chore: update version to 0.0.3 in manifest.yaml and bump dify_plugin to 0.4.5b2 in requirements.txt 2025-09-05 17:38:49 +08:00
Harry 6ea188988c chore: bump version to 0.4.5b2 in pyproject.toml 2025-09-04 21:32:56 +08:00
Harry 11954ee36e fix(github): improve payload parsing for GitHub webhooks
- Enhanced the GitHub provider to handle both form-encoded and JSON payloads from webhooks.
- Updated error handling to provide clearer messages for payload parsing issues.
- Ensured compatibility with various content types in incoming requests.

This change improves the robustness of the GitHub trigger integration by accommodating different data formats.
2025-09-04 21:32:27 +08:00
Harry 826a6df1a8 feat(trigger): enhance trigger validation and HTTP handling
- Updated `PluginExecutor` to return a result upon validating provider credentials.
- Renamed `ValidateProviderCredentials` to `ValidateTriggerCredentials` for consistency in trigger actions.
- Improved the `PluginRegistration` class to return OAuth schemas for registered providers.
- Added new error classes for better handling of trigger provider credential validation and OAuth errors.
- Refactored HTTP request and response serialization/deserialization for improved clarity and functionality.
- Enhanced GitHub provider to utilize new error handling and validation mechanisms.

This commit improves the overall structure and error management of the trigger system, ensuring better integration and usability.
2025-09-04 16:52:20 +08:00