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
51.14k stars 7.37k forks source link

设置文心一言api key和Secret Key报错 #2456

Closed jamesliu668 closed 8 months ago

jamesliu668 commented 8 months ago

Self Checks

Dify version

0.3.21

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

在模型供应商页面设置文心一言的api key和Secret Key报错。

✔️ Expected Behavior

设置正确

❌ Actual Behavior

返回错误信息如下: Credentials validation failed: Failed to get access token from Baidu: HTTPSConnectionPool(host='aip.baidubce.com', port=443): Max retries exceeded with url: /oauth/2.0/token?grant_type=client_credentials&client_id={MY-api-key}&client_secret={my secret key} (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f8e635bfd30>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

dosubot[bot] commented 8 months ago

🤖

你好,@jamesliu668!我是Dosu,一个可以帮助你解决bug、回答问题并成为贡献者的机器人。在等待人类维护者的同时,我在这里帮助你。我将马上查看你的问题,并很快给你一个完整的答复。

jamesliu668 commented 8 months ago

版本写错了,我现在用的是最新版本,0.5.5

dosubot[bot] commented 8 months ago

🤖

Based on the error message you're encountering, it seems like a network issue rather than a problem with the Dify code or your API and Secret keys. This error typically occurs when your system is unable to resolve the domain name to an IP address, which is necessary to establish a network connection.

Here are a few steps you can take to resolve this issue:

  1. Check your internet connection: Ensure that your system has a stable internet connection.

  2. DNS Server: Check if your DNS server is working correctly. You can try to change your DNS server to a public one like Google's (8.8.8.8 and 8.8.4.4) or Cloudflare's (1.1.1.1).

  3. Firewall/Security Groups: Ensure that your firewall or security group rules are not blocking outbound connections.

  4. Proxy: If you're behind a proxy, make sure it's configured correctly.

  5. Hosts File: Check your hosts file (located at /etc/hosts on Unix systems and C:\Windows\System32\drivers\etc\hosts on Windows) to ensure there are no incorrect entries.

If the problem persists after trying these steps, it might be a temporary issue with Baidu's servers. In this case, you might want to try again later or contact Baidu's support for further assistance.

As for how Dify handles network connections, specifically when interacting with the Baidu API, I wasn't able to find specific information within the repository. However, the file wenxin.tsx might provide some insights into how Dify interacts with the Wenxin Yiyuan API.

Please note that a similar issue was reported in the Dify repository: Get errors" Temporary failure in name resolution" when configuring API keys for some model providers. The suggested solution in that case was to configure DNS in /etc/docker/daemon.json to ensure proper DNS resolution within the Docker container. You might want to try this solution if the steps above do not resolve your issue.

I hope this helps! If you have any other questions or need further 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.
crazywoola commented 8 months ago

Close due to https://github.com/langgenius/dify/issues/1542

fuwj1994 commented 4 months ago

How to configure and test a proxy?