Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Dify tools with customized UI? e.g. embedding an iframe #3080

Closed
3 of 4 tasks
ifsheldon opened this issue Apr 2, 2024 · 2 comments
Closed
3 of 4 tasks

Dify tools with customized UI? e.g. embedding an iframe #3080

ifsheldon opened this issue Apr 2, 2024 · 2 comments
Labels
💪 enhancement New feature or request

Comments

@ifsheldon
Copy link

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Pleas do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing?

Yes. I want to make a tool that shows customized info visualization, like an interactive pie chart etc. But it seems we can only return text, images and links. Will dify automatically open the link that is returned by a tool?

2. Describe the feature you'd like to see

Allow a tool to open a website and place the UI in an iframe. Or, automatically open the link that's returned by a tool?

3. How will this feature improve your workflow or experience?

If this feature is implemented, users of the agent can use customized UI to interact with a tool, allowing more diverse interaction.

4. Additional context or comments

No response

5. Can you help us with this feature?

  • I am interested in contributing to this feature.
Copy link

dosubot bot commented Apr 2, 2024

Hey @ifsheldon! Long time no code! 🚀 How's the digital crafting going?

Based on the information available in the Dify repository, it is indeed possible to embed custom UI elements like iframes for displaying interactive visualizations. This can be achieved by utilizing the provided WebApp Templates, which are open source under the MIT license. You can modify these templates to include custom UI elements such as iframes. Here's a general approach:

  1. Choose a suitable WebApp Template from the ones provided on GitHub (e.g., Conversational app or Text generation app).

  2. Modify the HTML, CSS, and JavaScript files within the template to include custom UI elements like iframes. For example, to add an iframe, you would typically modify an HTML file within the project to include the iframe element:

    <iframe src="https://example.com" width="600" height="400"></iframe>
  3. Configure the Dify App ID and API Key in the config/index.ts file, along with any other necessary configurations specific to your application.

  4. Follow the deployment instructions provided in the README file of the WebApp Template to deploy your application with the custom UI elements.

You can find more details in the Dify documentation.

As for your question about automatically opening links returned by a tool, I wasn't able to find a direct answer within the repository. However, it's worth noting that the behavior of automatically opening links can often be controlled by the client (the user's browser or app), and not always by the server or the platform. This is typically a security measure to prevent unwanted redirections.

For displaying charts, a previous issue suggests using mermaid.js to display charts. You can ask the bot to return with mermaid.js to display some chart.

I hope this helps! If you have further questions or need more clarification, feel free to ask.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot dosubot bot added the 💪 enhancement New feature or request label Apr 2, 2024
@Yeuoly
Copy link
Collaborator

Yeuoly commented Apr 7, 2024

Great idea, then you refer to this PR #2612

@langgenius langgenius locked and limited conversation to collaborators Apr 12, 2024
@crazywoola crazywoola converted this issue into discussion #3400 Apr 12, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
💪 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants