Dify
Dify
Properties used to connect to Dify.
dify
-
Type:
true| {inputs?: object,user?: string,files?: {type: "file"|"collection", id: string}[]} -
Default: {user: "user"}
Connect to Dify's Chat API. You can set this property to true or configure it using an object:
inputs is an object containing custom input variables defined in your Dify application.
user is the user identifier for the conversation.
files is an array of pre-uploaded file references to include in the conversation. Each object requires a type ("file" or "collection") and an id referencing the uploaded file.
Example
- Sample code
- Full code
<deep-chat
directConnection='{
"dify": {
"key": "placeholder key",
"user": "deep-chat-user"
}
}'
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
directConnection='{
"dify": {
"key": "placeholder key",
"user": "deep-chat-user"
}
}'
style="border-radius: 8px"
></deep-chat>
Use stream to stream the AI responses.
File Upload Example
Upload files (images, documents, audio, video) alongside your messages:
- Sample code
- Full code
<deep-chat
directConnection='{
"dify": {"key": "placeholder key"}
}'
images="true"
mixedFiles="true"
></deep-chat>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<deep-chat
directConnection='{
"dify": {"key": "placeholder key"}
}'
images="true"
mixedFiles="true"
style="border-radius: 8px"
textInput='{"styles": {"container": {"width": "77%"}}}'
></deep-chat>
Files are automatically uploaded to Dify's file upload endpoint before being included in the chat message. Supported file types include images, documents, audio, and video.
Getting Your API Key
To use Dify with Deep Chat, you need to:
- Create a Dify account at dify.ai or set up a self-hosted instance
- Create an application (Chatbot, Agent, or Workflow)
- Get your API key from the application's API Access page
Your API key can be found in your Dify application under API Access in the left sidebar. See the Dify API documentation for more details.