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
43.32k stars 6k forks source link

Localhost preview does not work. #2863

Closed LLMR-boringtao closed 4 months ago

LLMR-boringtao commented 5 months ago

Self Checks

Provide a description of the help you need

Dify admin planner works properly on local. However, once I built an agent. I cannot preview it, such as using http://localhost/chat/sg52MLhzqyztDjKj

Anyone can help? Thanks!

dosubot[bot] commented 5 months ago

Hey there, @LLMR-boringtao! Fancy seeing you here again. How's everything going on your end?

Based on the information you've provided, it seems like you're having trouble previewing your Dify agent locally after building it. To better assist you, I'll need a bit more information about the issue you're experiencing.

  1. Could you please provide the exact error message or behavior you're observing when trying to preview the agent at the provided localhost URL? This will help me understand what might be going wrong.

  2. What version of Dify are you currently using? This is important as different versions might have different requirements or known issues.

  3. Could you confirm that you've followed the correct process to build the agent in Dify? Based on the repository, the process should involve choosing the application type, accessing Dify, navigating to Prompt Engineering, setting up prefix prompts, using variables, adjusting model parameters, and finally publishing the application. You can find more details about this process in the Dify documentation.

  4. Have you executed the necessary steps and commands to preview the agent locally? This includes cloning the repository, starting middleware services, setting up the Python environment, navigating to the "api" directory, starting the Worker service for asynchronous tasks, deploying the frontend page, and accessing the locally deployed Dify. More details about these steps can be found in the Dify documentation.

  5. Lastly, are there any specific error logs or console outputs that can provide more information about the issue? The error_code and description fields in each class can give a clear indication of what went wrong. You can find more details about this in the Dify source code.

Once I have this information, I'll be better equipped to help you troubleshoot the issue.

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.
crazywoola commented 5 months ago

Please provide more information, such as why and what did you get, better with some information from the web console.

LLMR-boringtao commented 5 months ago

Hi, Craztwoola @crazywoola

I followed exactly the same steps as I built on the Dify platform, on which once I build the agent, I click on the preview button, such as https://udify.app/chat/oFSTZX2eKGBAFSR, I can chat with the agent. On the other hand, on my local Mac, after the agent has been built and running successfully, I click on the preview, which is http://localhost/chat/sg52MLhzqyztDjKj, it open a webpage showing "cannot connect to server", nothing shown on the docker terminal.

Thanks!

LLMR-boringtao commented 5 months ago

@crazywoola

Then I try customising steps using the following parameters:

APP ID

NEXT_PUBLIC_APP_ID='2546cdfa-7d77-4748-a287-82acd37fe12b'

APP API key

NEXT_PUBLIC_APP_KEY='app-ZAuvFOZL2ZNKuVA77NAyAngt'

API url prefix

NEXT_PUBLIC_API_URL='http://localhost/v1'

Then after I nom run dev, and open localhost:3000, it shows: 500 App is unavailable. I confirm the DIFY backend is up running and working properly.

crazywoola commented 5 months ago

@crazywoola

Then I try customising steps using the following parameters:

APP ID

NEXT_PUBLIC_APP_ID='2546cdfa-7d77-4748-a287-82acd37fe12b'

APP API key

NEXT_PUBLIC_APP_KEY='app-ZAuvFOZL2ZNKuVA77NAyAngt'

API url prefix

NEXT_PUBLIC_API_URL='http://localhost/v1'

Then after I nom run dev, and open localhost:3000, it shows: 500 App is unavailable. I confirm the DIFY backend is up running and working properly.

"cannot connect to server" this means there is something wrong in your configuration file. And above codes are not relevant at all.

Hi, Craztwoola @crazywoola

I followed exactly the same steps as I built on the Dify platform, on which once I build the agent, I click on the preview button, such as https://udify.app/chat/oFSTZX2eKGBAFSR, I can chat with the agent. On the other hand, on my local Mac, after the agent has been built and running successfully, I click on the preview, which is http://localhost/chat/sg52MLhzqyztDjKj, it open a webpage showing "cannot connect to server", nothing shown on the docker terminal.

Thanks!

And this should be a frontend error, in this case, you need paste the information from the web console.