langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
35.66k stars 4.81k forks source link

Bug Icon Provider #5651

Closed TienLD-0801 closed 2 days ago

TienLD-0801 commented 3 days ago

Self Checks

Dify version

0.6.11

Cloud or Self Hosted

Cloud, Self Hosted (Docker), Self Hosted (Source)

Steps to reproduce

In the most recent commit update since the time I created the new issue, this icon is not working as expected, please reconsider.

Screenshot 2024-06-27 at 01 56 28

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

dosubot[bot] commented 3 days ago

To address the issue with the "Model Provider" icon not working as expected in Dify version 0.6.11, here are some steps and information that might help:

  1. Rendering Logic: The "Model Provider" icon is rendered using the ModelIcon component. This component checks if the provider is 'openai' and if the model name starts with 'gpt-4'. If both conditions are met, it renders the OpenaiViolet icon. Otherwise, it uses the provider.icon_small property to render an <img> element with the icon's URL. If neither condition is met, it falls back to a default CubeOutline icon [1].

  2. CSS and Styling Changes: Recent changes to the CSS and styling of the "Model Provider" icon include specific classes for different states and conditions. For example, the ModelIcon component has classes like mr-1.5 !w-5 !h-5, and the SlidersH icon has conditional classes based on the isInWorkflow prop [2].

  3. Common Errors and Logs: Common error messages or logs related to the "Model Provider" icon can be found in the server logs where the Flask application is running. Issues might arise from user permissions or icon retrieval failures in the ModelProviderIconApi class [3].

  4. Functionality and Behavior: The "Model Provider" icon should display the provider's small and large icons, show the provider's label and description, provide access to help information, allow users to manage configuration methods, and indicate supported model types and status [4].

If these steps do not resolve the issue, providing more detailed error messages from the frontend console and any backend error logs, along with your Docker setup details, could help further diagnose the problem.

To continue talking to Dosu, mention @dosu.

crazywoola commented 3 days ago

Can't reproduce on Cloud, I think this happens when you are trying to run from source code right? Try to clean the browser cache and restart the api service again to see if this persists.

TienLD-0801 commented 3 days ago

@crazywoola I tried everything but it still doesn't work I think the problem comes from this pull request

crazywoola commented 3 days ago

Which one. I have encountered this before long time ago, we just released model runtime that time. But it can't be reproduced now.

TienLD-0801 commented 3 days ago

@crazywoola So is there any way to solve it? I cleared caching like you said but it doesn't work Maybe , Maybe the could urls are not working yet. Ex : https://cloud.dify.ai/console/api/workspaces/current/model-providers/openai/icon_large/en_US?_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiZjhiZjMwZDYtZjcwMy00NzRkLTk2NjgtNDAwNGQ4OGQyMTIwIiwiZXhwIjoxNzIyMDU0MTI2LCJpc3MiOiJTRUxGX0hPU1RFRCIsInN1YiI6IkNvbnNvbGUgQVBJIFBhc3Nwb3J0In0.ZjSzZEGDihb4VimBTmY-OzexgItXcrv9t7xbQen1mIQ

Error : {"code": "unauthorized", "message": "Invalid token signature.", "status": 401}

monotykamary commented 2 days ago

This also happens when self-hosting. It's an issue that occurs when the default values point to their cloud service, which requires a proper token. This doesn't happen with earlier versions, so https://github.com/langgenius/dify/commit/488e3c3d565434bb6988d3d2120f0dfa9cb7fa4b#diff-89fafc265c1fa601cf2364b20be83308031335fda9467fcf3249d5ec1c0c8172 or https://github.com/langgenius/dify/commit/17d2f0bb0d3c7618ed59968613175d2344fcbdc1 or https://github.com/langgenius/dify/pull/5412 might be related.

monotykamary commented 2 days ago

It seems its more related how default values are generated for the environment variables. A quick workaround would be to explicitly set the domains yourself:

DOMAIN=https://example.com
CONSOLE_API_URL="$DOMAIN"
CONSOLE_WEB_URL="$DOMAIN"
SERVICE_API_URL="$DOMAIN"
APP_API_URL="$DOMAIN"
APP_WEB_URL="$DOMAIN"
ugyuji commented 2 days ago

@monotykamary Thank you! The same thing just happened with version 0.6.12 running on my local machine, and setting the domains explicitly just fixed the problem!

tienldbnk commented 2 days ago

@monotykamary @monotykamary good idea , I think it works very well so I will close this issue