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
45.95k stars 6.48k forks source link

Load balancing prompt parameter missing using jina model #8574

Open 18075717849 opened 2 hours ago

18075717849 commented 2 hours ago

Self Checks

Dify version

0.8.2

Cloud or Self Hosted

Cloud

Steps to reproduce

Using jina model load balancing, when adding key to save, it prompts that base_url is a required parameter, but it is missing. iwEcAqNwbmcDAQTRAlwF0QCsBrCdGjZ8jZcOnQbU7Fx1G_EAB9IcvYxiCAAJomltCgAL0SP1 png_720x720q90

✔️ Expected Behavior

What is the problem that causes base_url to be lost?

❌ Actual Behavior

What is the problem that causes base_url to be lost?

dosubot[bot] commented 2 hours ago

The issue you're encountering is due to the base_url parameter not being explicitly provided in the credentials dictionary when using load balancing with the Jina model. If base_url is not included in the credentials, the code defaults to using self.api_base, which is set to "https://api.jina.ai/v1".

Here's the relevant code snippet:

base_url = credentials.get("base_url", self.api_base)
base_url = base_url.removesuffix("/")

This means that if the credentials dictionary does not contain a base_url key, the base_url will default to "https://api.jina.ai/v1" [1].

To resolve this issue, ensure that the base_url parameter is included in the credentials dictionary when configuring load balancing for the Jina model.

To continue talking to Dosu, mention @dosu.

18075717849 commented 2 hours ago

Logically speaking, the default path should be used if it is not configured. I can configure it successfully when configuring the global model, but when configuring the load balancing, it prompts that base_url is missing.