-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Add dify extension #17706
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
Open
LogicOber
wants to merge
11
commits into
raycast:main
Choose a base branch
from
LogicOber:ext/dify
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add dify extension #17706
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f959f32
Add dify extension
LogicOber 39ce0ee
Update dify extension
LogicOber 13f4e93
fix: enhance error handling and streaming response reliability
LogicOber 0abd53b
package-lock.json
LogicOber b2d69c1
fix: improve text generator and workflow UI and fix API request issues
LogicOber 3a1c63b
update changelog & version
LogicOber 6b80b2a
Fix Dify Workflow response handling to properly parse and display out…
LogicOber 0071d55
Update dify extension
LogicOber 6191c1e
Update dify extension
LogicOber 835ab2c
fix: Update to theme-aware colors, resolve dependencies, update logo …
LogicOber 7797cd1
Update types.ts
andreaselia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"root": true, | ||
"extends": ["@raycast"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
|
||
# Raycast specific files | ||
raycast-env.d.ts | ||
|
||
# misc | ||
.DS_Store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"printWidth": 120, | ||
"singleQuote": false | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Dify Changelog | ||
|
||
## [1.0.0] - {PR_MERGE_DATE} | ||
|
||
- Seamless integration with Dify AI applications | ||
- AI Tools integration with Raycast command system (@dify) | ||
- Add Dify App command for configuring new Dify applications | ||
- Send to Dify command for interactive conversations with Dify AI | ||
- List Dify command for managing your Dify applications | ||
- View Conversations command for accessing conversation history (renamed to "View History" for more intuitive navigation) | ||
- Support for various application types: Chatflow/Agent, Workflow, Text Generator | ||
- Conversation continuity with Continuous and Single Call modes | ||
- Response streaming support for real-time interactions | ||
- Flexible Wait for Response options | ||
- Support for customizable input parameters in various formats | ||
- Improved input field validation to filter out invalid input names (empty or whitespace-only) | ||
- Enhanced AI extraction logic to work with validated input fields | ||
- Fixed syntax errors and improved code structure | ||
- Better error handling for network issues | ||
- Maintained original query integrity when processing inputs | ||
- Enhanced type safety by replacing string literals with enum types for response modes | ||
- Improved error handling in streaming mode to prevent silent failures | ||
- Fixed premature termination issues in streaming responses | ||
- Added meaningful error messages instead of empty responses | ||
- Improved code formatting and linting across the codebase | ||
- Enhanced error propagation to ensure users receive proper error notifications | ||
- Improved UI interface for text generator and workflow modes | ||
- Enhanced detail view display for non-conversational app types | ||
- Fixed bug causing text generator to make duplicate API requests | ||
- Added debounce protection to prevent multiple submissions | ||
- Made inputs parameter optional for all app types | ||
- Resolved interface compatibility issues with text generator | ||
- Improved validation logic to properly handle optional inputs | ||
- Added ability to parse Inputs field and generate dynamic input forms | ||
- Fixed Workflow response handling to properly parse and display outputs from both response formats | ||
- Enhanced type safety by implementing proper TypeScript interfaces for Workflow responses | ||
- Improved error handling for different API response structures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# Dify AI Extension for Raycast | ||
|
||
Seamlessly integrate all Dify AI applications into Raycast with a single click, enabling instant access and execution within Raycast. | ||
|
||
## Features | ||
|
||
- Seamless integration with Dify AI applications | ||
- Easy management of all Dify applications | ||
- Direct interaction with AI applications within Raycast | ||
- Support for conversation continuity and user identification | ||
|
||
## Commands | ||
|
||
This extension provides several commands to interact with Dify AI applications. Below is a detailed guide for each command. | ||
|
||
### Add Dify App | ||
|
||
Add a new Dify application to your Raycast extension. | ||
|
||
| Parameter | Required | Description | | ||
| ----------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| Application Name | Yes | A unique name to identify this Dify application in Raycast | | ||
| Endpoint | Yes | The API URL for your Dify application (default: https://api.dify.ai/v1) | | ||
| API Key | Yes | The API key obtained from Dify | | ||
| Input Parameters | No | Comma-separated list of input parameter names required by your Dify application | | ||
| Application Type | Yes | Type of Dify application: Chatflow/Agent, Workflow, or Text Generator | | ||
| Assistant Name | No | Custom name for the assistant in responses (will appear in the history, for example: Assistant_name: Hello World!) | | ||
| Response Mode | Yes | Choose between blocking (default) or streaming response mode | | ||
| Wait for Response | Yes | Whether to wait for the complete response (Yes) or just check API call success (No) (By default, it is Wait Mode, meaning that when initiating an API call using @Dify, it waits for the return result, or it only cares whether the API request was successfully sent.) | | ||
LogicOber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Conversation Type | Yes | Choose between Continuous (maintain conversation history) or Single Call (It means that when you use @Dify, it tracks the Conversation_id. By default, it is Continuous, meaning that it will store the conversation_id of the corresponding Dify App used last time (even if Raycast is closed and reopened next time), unless the user explicitly states to start a new conversation or change the topic. In this case, the AI will automatically start a new conversation session. Of course, since the Raycast call allows viewing the conversation_id, you can also manually specify the conversation id.) | | ||
LogicOber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Description | No | Optional description of the application (It is recommended that you briefly describe the purpose of this app in English, as this will help Raycast determine which app to call when using @Dify, thereby improving accuracy.) | | ||
|
||
### Ask Dify | ||
|
||
Interact with a Dify application by sending queries and receiving responses. | ||
|
||
| Parameter | Required | Description | | ||
| ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- | | ||
| Input | Yes | Your query or message to send to the Dify application | | ||
| Application | Yes | Select from your previously added Dify applications | | ||
| Input Parameters | No | Provide values for any input parameters required by the application (JSON format, named parameters, or simple values.) | | ||
| User ID | No | Custom identifier for the user (helps with conversation tracking, defaults to Raycast_{systemName}) | | ||
|
||
### List Dify Apps | ||
|
||
View, edit, or delete your configured Dify applications. | ||
|
||
| Action | Description | | ||
| ------------ | ---------------------------------------------------------- | | ||
| View Details | See complete configuration details for an application | | ||
| Edit | Modify any application settings | | ||
| Delete | Remove an application from your configuration | | ||
| Ask | Quickly start a conversation with the selected application | | ||
|
||
### Dify History | ||
|
||
View and manage your conversation history with Dify applications. | ||
|
||
| Action | Description | | ||
| --------------------- | -------------------------------------------------------- | | ||
| Continue Conversation | Resume a previous conversation thread | | ||
| View Details | See the complete conversation history | | ||
| Edit Conversation | Modify the conversation content (for reference purposes) | | ||
| Delete Conversation | Remove a conversation from history | | ||
| Clear All History | Delete all conversation history | | ||
|
||
### Input Parameters Format | ||
|
||
When providing input parameters, you can use any of these formats: | ||
|
||
1. **JSON format**: `{"var1": "value1", "var2": "value2"}` | ||
2. **Named parameters**: `var1=value1, var2=value2` | ||
3. **Simple values**: `value1, value2` (values will be assigned in order) | ||
|
||
## AI Tools Usage Examples | ||
|
||
The Dify extension provides powerful AI capabilities through Raycast's AI command system. Here are some examples of how to use these tools: | ||
|
||
1. **Research with DeepResearch App**: | ||
|
||
``` | ||
@Dify, please use the DeepResearch App to complete a research task related to quantum computing advancements in 2024. | ||
``` | ||
2. **Combining Notes with Research**: | ||
|
||
``` | ||
@raycast-notes, please retrieve my notes on renewable energy technologies, this is background information. Please send this completely to @Dify, forwarding it to the DeepResearch App. Although my App Detail is set to Waiting mode, please use Non-Waiting mode this time. | ||
``` | ||
3. **Task Management with Reminders**: | ||
|
||
``` | ||
@apple-reminders, please check all tasks in the "School" List, @Dify select appropriate Apps to complete each of these tasks. | ||
``` | ||
4. **GitHub Repository Analysis**: | ||
|
||
``` | ||
@Dify, please use the Github Repo Explainer App, start a new conversation, with inputs url set to https://github.com/cyclotruc/gitingest | ||
``` | ||
5. **Listen to Music and Learn Technical Terms**: | ||
|
||
``` | ||
@spotify-player, first play Aimyon's Marigold, then @Dify help me interpret all the technical terminology in the current tab window. (Before this, you need to open the Raycast AI chat window, then use + to add the Add Focused Browser Tab option to get the tab content) | ||
``` | ||
|
||
6. **Extension Development**: | ||
|
||
``` | ||
@Dify, please use Raycast Extension Agent to help me create a pomodoro timer command that displays a dynamic pomodoro timer component in detail view, defaulting to 25 minutes, using interesting symbols for the progress bar. The panel should allow pausing, resetting, and entering rest sessions. After writing it, use @shell to save it to the designated folder on my desktop. | ||
``` | ||
|
||
## Where can I get Dify DSL | ||
|
||
1. **Social Media**: Search on X (formerly Twitter) for shared DSL documents. You can find many resources shared by other users in various languages including English, Chinese, and Japanese. | ||
2. **Dify.AI Explorer**: Add ready-to-use official workflows in the Dify.AI Explorer. For example, you can find workflows like DeepResearch that are officially released and available for immediate use. | ||
3. **GitHub Resources**: Visit [Awesome-Dify-Workflow](https://github.com/svcvit/Awesome-Dify-Workflow) for a collection of reference workflows and examples. | ||
4. **Learning Resources**: Check out [dify101.com](https://dify101.com) for additional learning materials and guides. | ||
|
||
DSL workflows are best used for creating highly personalized and customized design processes for yourself or for your company. | ||
|
||
We encourage users to develop their own workflows. For maximum flexibility, we recommend using the **Chatflow** type in Dify.AI, as it offers the greatest versatility for custom implementations. | ||
|
||
Additionally, the Plugin System in Dify.AI is continuously evolving and improving. You can find interesting Nodes for developing Dify applications in the Plugin Marketplace, and then add them to your local environment using the "Add Dify App" command in Raycast. | ||
|
||
## License | ||
|
||
MIT License | ||
|
||
## Contributor | ||
|
||
[@LogicOber](https://github.com/LogicOber) | ||
[@Lyson Ober](https://x.com/lyson_ober) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"instructions": "When a user wants to query a Dify application, first use the list-dify-apps tool to get a list of available applications and their details, then use the ask-dify tool to send the query. Do not attempt to guess application names or interface parameters, you must base them on the information returned by list-dify-apps.", | ||
"evals": [ | ||
{ | ||
"input": "@dify I would like to ask about artificial intelligence knowledge", | ||
"expected": [ | ||
{"callsTool": "list-dify-apps"}, | ||
{"callsTool": {"name": "ask-dify", "arguments": {"query": {"includes": "artificial intelligence"}}}} | ||
] | ||
}, | ||
{ | ||
"input": "@dify Use the ChatGPT app to ask what is machine learning", | ||
"expected": [ | ||
{"callsTool": "list-dify-apps"}, | ||
{"callsTool": {"name": "ask-dify", "arguments": {"appName": "ChatGPT", "query": {"includes": "machine learning"}}}} | ||
] | ||
}, | ||
{ | ||
"input": "@dify List all my applications", | ||
"expected": [ | ||
{"callsTool": "list-dify-apps"} | ||
] | ||
}, | ||
{ | ||
"input": "@dify Tell me about my SlackNote application", | ||
"expected": [ | ||
{"callsTool": "list-dify-apps"}, | ||
{"callsTool": "explain-dify-app"} | ||
LogicOber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
] | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.