Connect with Dify via Custom Tool #3049
taowang1993
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I deployed both Flowise and Dify.
Both are awesome work, and each differs in strength.
Is it possible to create a connection between Flowise and Dify? Like this?
@HenryHengZJ
I tried the following code to create the custom tool, but it did not work.
const fetch = require('node-fetch');
// Dify API environment variables
const APP_ID = "xxxxxxxxxx";
const APP_KEY = "xxxxxxxxxxx";
const API_URL = "xxxxxxxxxxx";
// Flowise custom tool
module.exports = async function(context) {
try {
// Extract the required parameters from the context
const { query, user, files } = context.input;
} catch (error) {
console.error('Error occurred while fetching data from Dify:', error);
return { error: error.message };
}
};
Here is Dify API reference
curl -X POST 'https://api.dify.ai/v1/chat-messages'
--header 'Authorization: Bearer {api_key}'
--header 'Content-Type: application/json'
--data-raw '{
"inputs": {},
"query": "What are the specs of the iPhone 13 Pro Max?",
"response_mode": "streaming",
"conversation_id": "",
"user": "abc-123",
"files": [
{
"type": "image",
"transfer_method": "remote_url",
"url": "https://cloud.dify.ai/logo/logo-site.png"
}
]
}'
Beta Was this translation helpful? Give feedback.
All reactions