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
48.7k stars 6.98k forks source link

Environment variables for ModelProvider and Tool Position are not working #9645

Open tkoshida opened 2 hours ago

tkoshida commented 2 hours ago

Self Checks

Dify version

0.9.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Set the value of POSITION_TOOL_INCLUDES in the .env file (e.g., bing, google).
  2. Restart Dify
    docker compose down
    docker compose up -d

✔️ Expected Behavior

The toolset on the following screen is limited to the specified tools http://localhost/tools

❌ Actual Behavior

Nothing changes

tkoshida commented 2 hours ago

You might need to add the following settings to the x-shared-env section of the docker-compose.yaml:

POSITION_TOOL_PINS: ${POSITION_TOOL_PINS:-}
POSITION_TOOL_INCLUDES: ${POSITION_TOOL_INCLUDES:-}
POSITION_TOOL_EXCLUDES: ${POSITION_TOOL_EXCLUDES:-}
POSITION_PROVIDER_PINS: ${POSITION_PROVIDER_PINS:-}
POSITION_PROVIDER_INCLUDES: ${POSITION_PROVIDER_INCLUDES:-}
POSITION_PROVIDER_EXCLUDES: ${POSITION_PROVIDER_EXCLUDES:-}
crazywoola commented 1 hour ago

Fell free to open a pr for this.

dosubot[bot] commented 1 hour ago

Hey there, @tkoshida! I'm here to assist you with any bugs, questions, or contributions. Let's tackle this together while we wait for a human maintainer.

I found some relevant information that might help with your issue. The POSITION_TOOL_INCLUDES environment variable is used to specify which tools should be included in the application. Only the tools listed in this variable will be available for use. If this variable is not set, all tools are included by default unless they are specified in POSITION_TOOL_EXCLUDES [1].

To ensure these environment variables are correctly applied, you should add them to the x-shared-env section in your docker-compose.yaml file. This section is used to define shared environment variables that can be reused across multiple services, ensuring consistent configuration [2].

Here's how you can add these settings to the x-shared-env section:

x-shared-env: &shared-api-worker-env
  POSITION_TOOL_PINS: ${POSITION_TOOL_PINS:-}
  POSITION_TOOL_INCLUDES: ${POSITION_TOOL_INCLUDES:-}
  POSITION_TOOL_EXCLUDES: ${POSITION_TOOL_EXCLUDES:-}
  POSITION_PROVIDER_PINS: ${POSITION_PROVIDER_PINS:-}
  POSITION_PROVIDER_INCLUDES: ${POSITION_PROVIDER_INCLUDES:-}
  POSITION_PROVIDER_EXCLUDES: ${POSITION_PROVIDER_EXCLUDES:-}

After making these changes, restart your Docker services to apply the new configuration:

docker compose down
docker compose up -d

This should help ensure that the specified tools are included as expected.

To continue talking to Dosu, mention @dosu.