From de27a23a25ed8f0f9c37dcecab2b6f77560a5860 Mon Sep 17 00:00:00 2001 From: xuzijie1995 <18852951350@163.com> Date: Sun, 1 Jun 2025 15:08:22 +0800 Subject: [PATCH] Docs: Clarify uv and poetry usage for migration commands Updated documentation for migrating to Dify v1.0.0+ across English, Japanese, and Simplified Chinese versions (in and files). Key changes: - Main titles and accordion titles updated from v1.0.0 to v1.0.0+ to reflect broader applicability. - Prioritized as the standard command in examples for Dify v1.3.0+ environments. - Commented out and clarified its specific use case: for migrations targeting Dify versions from v1.0.0 up to (but not including) v1.3.0. - Refined introductory notes and usage for better clarity and user-friendliness. - Ensured consistent referencing of the Dify v1.3.0 release notes regarding the transition. --- en/development/migration/migrate-to-v1.mdx | 34 +++++++++++++----- en/getting-started/dify-premium.mdx | 28 +++++++++++---- ja-jp/development/migration/migrate-to-v1.mdx | 36 ++++++++++++++----- ja-jp/getting-started/dify-premium.mdx | 30 ++++++++++++---- .../development/migration/migrate-to-v1.mdx | 36 ++++++++++++++----- zh-hans/getting-started/dify-premium.mdx | 33 ++++++++++++----- 6 files changed, 150 insertions(+), 47 deletions(-) diff --git a/en/development/migration/migrate-to-v1.mdx b/en/development/migration/migrate-to-v1.mdx index 3c697109..4ec51eaa 100644 --- a/en/development/migration/migrate-to-v1.mdx +++ b/en/development/migration/migrate-to-v1.mdx @@ -1,5 +1,5 @@ --- -title: Upgrading Community Edition to v1.0.0 +title: Upgrading Community Edition to v1.0.0+ --- > This document primarily explains how to upgrade from an older Community Edition version to [v1.0.0](https://github.com/langgenius/dify/releases/tag/1.0.0). If you have not installed the Dify Community Edition yet, you can directly clone the [Dify project](https://github.com/langgenius/dify) and switch to the `1.0.0` branch. For installation commands, refer to the [documentation](/en/getting-started/install-self-hosted/docker-compose). @@ -46,9 +46,15 @@ docker compose -f docker-compose.yaml up -d ### 3. Migrate Tools to Plugins +> **Important Note on Command Execution and Package Management:** +> * **Default Container Name:** The `docker exec` command examples use `docker-api-1`. If your API container has a different name or ID (which you can find using `docker ps`), please adjust the command accordingly. +> * **Python Package Manager (`uv` vs. `poetry`):** + * Dify switched from `poetry` to `uv` for Python package management starting with version [v1.3.0](https://github.com/langgenius/dify/releases/tag/1.3.0) to enhance performance. For general operations in Dify v1.3.0 or newer, the standard command is `uv run flask ...`. + * **This guide focuses on upgrading to Dify v1.0.0.** During the period of Dify v1.0.0 up to (but not including) v1.3.0, `poetry` was the package manager. Therefore, the `flask` commands in the examples below correctly use `poetry run ...`. The code examples emphasize the current `uv` standard in comments first, then show the `poetry` command relevant to this guide's specific v1.0.0 migration scope. + The purpose of this step is to automatically migrate the tools and model vendors previously used in the Community Edition and install them into the new plugin environment. -1. Run the docker ps command to check the docker-api container ID. +1. Run the `docker ps` command to check the API container name or ID. The default is often `docker-api-1`. Example: @@ -60,20 +66,28 @@ f84aa773**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi a3cb19c2**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi…" 3 hours ago Up 3 hours 5001/tcp docker-api-1 ``` -Run the command `docker exec -it a3cb19c2**** bash` to enter the container terminal, and then run: +Run the command `docker exec -it docker-api-1 bash` to enter the container terminal (if your container name is different, use that instead), and then run: ```bash -poetry run flask extract-plugins --workers=20 +# For Dify v1.3.0+ environments, the standard command is 'uv run ...'. +uv run flask extract-plugins --workers=20 +# +# If your target migration version is Dify v1.0.0 up to (but not including) v1.3.0, use 'poetry': +# poetry run flask extract-plugins --workers=20 ``` -> If an error occurs, it is recommended to first install the `poetry` environment on the server as per the prerequisites. If the terminal asks for input after running the command, press **“Enter”** to skip the input. +> If an error occurs (e.g., `uv` or `poetry` not found) when trying to execute the commands as per this guide for v1.0.0 migration, ensure the `poetry` environment is correctly set up on the server as per the original prerequisites for that version. If the terminal asks for input after running a `poetry` command, press **"Enter"** to skip. This command will extract all models and tools currently in use in the environment. The workers parameter controls the number of parallel processes used during extraction and can be adjusted as needed. After the command runs, it will generate a `plugins.jsonl` file containing plugin information for all workspaces in the current Dify instance. Ensure your network can access the public internet and support access to: `https://marketplace.dify.ai`. Continue running the following command in the `docker-api-1` container: ```bash -poetry run flask install-plugins --workers=2 +# For Dify v1.3.0+ environments, the standard command is 'uv run ...'. +uv run flask install-plugins --workers=2 +# +# If your target migration version is Dify v1.0.0 up to (but not including) v1.3.0, use 'poetry': +# poetry run flask install-plugins --workers=2 ``` This command will download and install all necessary plugins into the latest Community Edition. @@ -81,7 +95,11 @@ This command will download and install all necessary plugins into the latest Com Finally, migrate the plugin data. Run the following command to update the `provider name` by appending `langgenius/{provider_name}/{provider_name}` to it. ```bash -poetry run flask migrate-data-for-plugin +# For Dify v1.3.0+ environments, the standard command is 'uv run ...'. +uv run flask migrate-data-for-plugin +# +# If your target migration version is Dify v1.0.0 up to (but not including) v1.3.0, use 'poetry': +# poetry run flask migrate-data-for-plugin ``` The migration is complete when you see the results in your terminal. @@ -93,7 +111,7 @@ Migrate data for plugin completed. ## Verify the Migration -Access the Dify platform and click the **“Plugins”** button in the upper-right corner to check if the previously used tools have been correctly installed. Randomly use one of the plugins to verify if it works properly. If the plugins work well, the version upgrade and data migration have been successfully completed. +Access the Dify platform and click the **"Plugins"** button in the upper-right corner to check if the previously used tools have been correctly installed. Randomly use one of the plugins to verify if it works properly. If the plugins work well, the version upgrade and data migration have been successfully completed. {/* Contributing Section diff --git a/en/getting-started/dify-premium.mdx b/en/getting-started/dify-premium.mdx index dbaa0920..cc5aafba 100644 --- a/en/getting-started/dify-premium.mdx +++ b/en/getting-started/dify-premium.mdx @@ -29,7 +29,9 @@ docker-compose -f docker-compose.yaml -f docker-compose.override.yaml up -d > To upgrade to version v1.0.0, please refer to [Migrating Community Edition to v1.0.0](/en/development/migration/migrate-to-v1). - + + +> This section describes migrating an older Community Edition to Dify v1.0.0+. For general upgrades of Dify Premium or Community Edition to versions *later* than this specific migration scope, please refer to their respective main upgrade instructions. The upgrade process involves the following steps: @@ -67,9 +69,15 @@ docker compose -f docker-compose.yaml up -d ### 3. Migrate Tools to Plugins +> **Important Note on Command Execution and Package Management (for v1.0.0 migration):** +> * **Default Container Name:** The `docker exec` command examples use `docker-api-1`. If your API container has a different name or ID (which you can find using `docker ps`), please adjust the command accordingly. +> * **Python Package Manager (`uv` vs. `poetry`):** + * Dify switched from `poetry` to `uv` for Python package management starting with version [v1.3.0](https://github.com/langgenius/dify/releases/tag/1.3.0) to enhance performance. For general operations in Dify v1.3.0 or newer, the standard command is `uv run flask ...`. + * **This specific section focuses on upgrading to Dify v1.0.0.** During the period of Dify v1.0.0 up to (but not including) v1.3.0, `poetry` was the package manager. Therefore, the `flask` commands in the examples below correctly use `poetry run ...`. The code examples emphasize the current `uv` standard in comments first, then show the `poetry` command relevant to this specific v1.0.0 migration scope. + The purpose of this step is to automatically migrate the tools and model vendors previously used in the Community Edition and install them into the new plugin environment. -1. Run the docker ps command to check the docker-api container ID. +1. Run the `docker ps` command to check the API container name or ID. The default is often `docker-api-1`. Example: @@ -81,20 +89,28 @@ f84aa773**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi a3cb19c2**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi…" 3 hours ago Up 3 hours 5001/tcp docker-api-1 ``` -Run the command `docker exec -it a3cb19c2**** bash` to enter the container terminal, and then run: +Run the command `docker exec -it docker-api-1 bash` to enter the container terminal (if your container name is different, use that instead), and then run: ```bash -poetry run flask extract-plugins --workers=20 +# For Dify v1.3.0+ environments, the standard command is 'uv run ...'. +uv run flask extract-plugins --workers=20 +# +# If your target migration version for the Community Edition part described here is Dify v1.0.0 up to (but not including) v1.3.0, use 'poetry': +# poetry run flask extract-plugins --workers=20 ``` -> If an error occurs, it is recommended to first install the `poetry` environment on the server as per the prerequisites. If the terminal asks for input after running the command, press **“Enter”** to skip the input. +> If an error occurs (e.g., `uv` or `poetry` not found) when trying to execute the commands as per this guide for v1.0.0 migration, ensure the `poetry` environment is correctly set up on the server as per the original prerequisites for that version. If the terminal asks for input after running a `poetry` command, press **"Enter"** to skip. This command will extract all models and tools currently in use in the environment. The workers parameter controls the number of parallel processes used during extraction and can be adjusted as needed. After the command runs, it will generate a `plugins.jsonl` file containing plugin information for all workspaces in the current Dify instance. Ensure your network can access the public internet and support access to: `https://marketplace.dify.ai`. Continue running the following command in the `docker-api-1` container: ```bash -poetry run flask install-plugins --workers=2 +# For Dify v1.3.0+ environments, the standard command is 'uv run ...'. +uv run flask install-plugins --workers=2 +# +# If your target migration version for the Community Edition part described here is Dify v1.0.0 up to (but not including) v1.3.0, use 'poetry': +# poetry run flask install-plugins --workers=2 ``` This command will download and install all necessary plugins into the latest Community Edition. When the terminal shows `Install plugins completed.`, the migration is complete. diff --git a/ja-jp/development/migration/migrate-to-v1.mdx b/ja-jp/development/migration/migrate-to-v1.mdx index b3e934bc..b3be4f6f 100644 --- a/ja-jp/development/migration/migrate-to-v1.mdx +++ b/ja-jp/development/migration/migrate-to-v1.mdx @@ -1,5 +1,5 @@ --- -title: コミュニティ版を v1.0.0 にアップグレードする +title: コミュニティ版を v1.0.0+ にアップグレードする --- @@ -47,9 +47,15 @@ docker compose -f docker-compose.yaml up -d ### 3. ツールの移行をプラグインに変換 +> **重要な注意点:コマンド実行とパッケージ管理について** +> * **デフォルトのコンテナ名:** `docker exec` コマンドの例では `docker-api-1` を使用しています。APIコンテナ名やIDが異なる場合(`docker ps` で確認可能)は、コマンドを適宜修正してください。 +> * **Pythonパッケージマネージャー (`uv` vs `poetry`):** + * Difyは、パフォーマンス向上のため、バージョン [v1.3.0](https://github.com/langgenius/dify/releases/tag/1.3.0) からPythonパッケージマネージャーを `poetry` から `uv` に切り替えました。Dify v1.3.0以降の一般的な操作では、標準コマンドは `uv run flask ...` です。 + * **このガイドはDify v1.0.0へのアップグレードに焦点を当てています。** Dify v1.0.0からv1.3.0(v1.3.0を含まない)までの期間は、`poetry` がパッケージマネージャーでした。そのため、以下の例の `flask` コマンドは `poetry run ...` を正しく使用しています。コード例では、まず現在の `uv` の標準をコメントで強調し、次にこのガイドの特定のv1.0.0移行スコープに関連する `poetry` コマンドを示しています。 + このステップでは、以前のコミュニティ版で使用していたツールやモデルプロバイダを自動的にデータ移行し、新しいバージョンのプラグイン環境にインストールします。 -1. `docker ps` コマンドを実行して、docker-api コンテナの ID を確認します。 +1. `docker ps` コマンドを実行して、APIコンテナの名前またはIDを確認します。デフォルトは多くの場合 `docker-api-1` です。 例: @@ -61,20 +67,28 @@ f84aa773**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi a3cb19c2**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi…" 3 hours ago Up 3 hours 5001/tcp docker-api-1 ``` -`docker exec -it a3cb19c2**** bash` コマンドを実行してコンテナのターミナルにアクセスし、以下を実行します: +`docker exec -it docker-api-1 bash` コマンドを実行してコンテナのターミナルにアクセスし(コンテナ名が異なる場合は、その名前を使用してください)、以下を実行します: ```bash -poetry run flask extract-plugins --workers=20 +# Dify v1.3.0以降の環境では、標準コマンドは 'uv run ...' です。 +uv run flask extract-plugins --workers=20 +# +# 移行対象バージョンがDify v1.0.0からv1.3.0(v1.3.0を含まない)までの場合は、'poetry'を使用してください: +# poetry run flask extract-plugins --workers=20 ``` -> エラーが発生した場合は、サーバーに `poetry` 環境をインストールしてから実行してください。コマンド実行後、端末に入力待機のプロンプトが表示された場合は「Enter」を押して入力をスキップします。 +> v1.0.0移行のためにこのガイドに従ってコマンドを実行しようとしてエラー(例:`uv`または`poetry`が見つからない)が発生した場合、そのバージョンの元の前提条件に従ってサーバーに`poetry`環境が正しくセットアップされていることを確認してください。 `poetry`コマンドの実行後に端末が入力を求めてきた場合は、「Enter」を押してスキップします。 このコマンドは、現在の環境で使用しているすべてのモデルとツールを抽出します。workers パラメータは並行プロセス数を決定し、必要に応じて調整できます。コマンドが終了すると、結果が保存される `plugins.jsonl` ファイルが生成されます。このファイルには、現在の Dify インスタンス内のすべてのワークスペースのプラグイン情報が含まれます。 インターネット接続が正常で、`https://marketplace.dify.ai` にアクセスできることを確認してください。`docker-api-1` コンテナ内で以下のコマンドを実行します: ```bash -poetry run flask install-plugins --workers=2 +# Dify v1.3.0以降の環境では、標準コマンドは 'uv run ...' です。 +uv run flask install-plugins --workers=2 +# +# 移行対象バージョンがDify v1.0.0からv1.3.0(v1.3.0を含まない)までの場合は、'poetry'を使用してください: +# poetry run flask install-plugins --workers=2 ``` このコマンドは、最新のコミュニティ版に必要なすべてのプラグインをダウンロードしてインストールします。 @@ -82,8 +96,12 @@ poetry run flask install-plugins --workers=2 最後に、プラグインのデータを移行します。このコマンドは `provider name` を更新し、`langgenius/{provider_name}/{provider_name}` を追加します ```bash -poetry run flask migrate-data-for-plugin -``` +# Dify v1.3.0以降の環境では、標準コマンドは 'uv run ...' です。 +uv run flask migrate-data-for-plugin +# +# 移行対象バージョンがDify v1.0.0からv1.3.0(v1.3.0を含まない)までの場合は、'poetry'を使用してください: +# poetry run flask migrate-data-for-plugin +``` ターミナルに結果が表示されたら、マイグレーションは完了です。 @@ -115,7 +133,7 @@ It will be automatically generated by the script. エラーを見つけたり提案がありますか?お知らせください diff --git a/ja-jp/getting-started/dify-premium.mdx b/ja-jp/getting-started/dify-premium.mdx index ed0704fa..482e4956 100644 --- a/ja-jp/getting-started/dify-premium.mdx +++ b/ja-jp/getting-started/dify-premium.mdx @@ -29,7 +29,9 @@ docker-compose pull docker-compose -f docker-compose.yaml -f docker-compose.override.yaml up -d ``` - + + +> このセクションでは、旧コミュニティ版をDify v1.0.0+に移行する方法について説明します。Dify Premiumまたはコミュニティ版をこの特定の移行範囲*以降*のバージョンにアップグレードする場合は、それぞれの主要なアップグレード手順を参照してください。 アップグレードは以下の手順で行います: @@ -67,9 +69,15 @@ docker compose -f docker-compose.yaml up -d ### 3. ツールの移行をプラグインに変換 +> **コマンド実行とパッケージ管理に関する重要な注意点(v1.0.0移行の場合):** +> * **デフォルトのコンテナ名:** `docker exec` コマンドの例では `docker-api-1` を使用しています。APIコンテナ名やIDが異なる場合(`docker ps` で確認可能)は、コマンドを適宜修正してください。 +> * **Pythonパッケージマネージャー (`uv` vs `poetry`):** + * Difyは、パフォーマンス向上のため、バージョン [v1.3.0](https://github.com/langgenius/dify/releases/tag/1.3.0) からPythonパッケージマネージャーを `poetry` から `uv` に切り替えました。Dify v1.3.0以降の一般的な操作では、標準コマンドは `uv run flask ...` です。 + * **この特定のセクションはDify v1.0.0へのアップグレードに焦点を当てています。** Dify v1.0.0からv1.3.0(v1.3.0を含まない)までの期間は、`poetry` がパッケージマネージャーでした。そのため、以下の例の `flask` コマンドは `poetry run ...` を正しく使用しています。コード例では、まず現在の `uv` の標準をコメントで強調し、次にこの特定のv1.0.0移行スコープに関連する `poetry` コマンドを示しています。 + このステップでは、以前のコミュニティ版で使用していたツールやモデルプロバイダを自動的にデータ移行し、新しいバージョンのプラグイン環境にインストールします。 -1. `docker ps` コマンドを実行して、docker-api コンテナの ID を確認します。 +1. `docker ps` コマンドを実行して、APIコンテナの名前またはIDを確認します。デフォルトは多くの場合 `docker-api-1` です。 例: @@ -81,20 +89,28 @@ f84aa773**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi a3cb19c2**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi…" 3 hours ago Up 3 hours 5001/tcp docker-api-1 ``` -`docker exec -it a3cb19c2**** bash` コマンドを実行してコンテナのターミナルにアクセスし、以下を実行します: +`docker exec -it docker-api-1 bash` コマンドを実行してコンテナのターミナルにアクセスし(コンテナ名が異なる場合は、その名前を使用してください)、以下を実行します: ```bash -poetry run flask extract-plugins --workers=20 +# Dify v1.3.0以降の環境では、標準コマンドは 'uv run ...' です。 +uv run flask extract-plugins --workers=20 +# +# ここで説明するコミュニティ版部分の移行対象バージョンがDify v1.0.0からv1.3.0(v1.3.0を含まない)までの場合は、'poetry'を使用してください: +# poetry run flask extract-plugins --workers=20 ``` -> エラーが発生した場合は、サーバーに `poetry` 環境をインストールしてから実行してください。コマンド実行後、端末に入力待機のプロンプトが表示された場合は「Enter」を押して入力をスキップします。 +> v1.0.0移行のためにこのガイドに従ってコマンドを実行しようとしてエラー(例:`uv`または`poetry`が見つからない)が発生した場合、そのバージョンの元の前提条件に従ってサーバーに`poetry`環境が正しくセットアップされていることを確認してください。 `poetry`コマンドの実行後に端末が入力を求めてきた場合は、「Enter」を押してスキップします。 このコマンドは、現在の環境で使用しているすべてのモデルとツールを抽出します。workers パラメータは並行プロセス数を決定し、必要に応じて調整できます。コマンドが終了すると、結果が保存される `plugins.jsonl` ファイルが生成されます。このファイルには、現在の Dify インスタンス内のすべてのワークスペースのプラグイン情報が含まれます。 インターネット接続が正常で、`https://marketplace.dify.ai` にアクセスできることを確認してください。`docker-api-1` コンテナ内で以下のコマンドを実行します: ```bash -poetry run flask install-plugins --workers=2 +# Dify v1.3.0以降の環境では、標準コマンドは 'uv run ...' です。 +uv run flask install-plugins --workers=2 +# +# ここで説明するコミュニティ版部分の移行対象バージョンがDify v1.0.0からv1.3.0(v1.3.0を含まない)までの場合は、'poetry'を使用してください: +# poetry run flask install-plugins --workers=2 ``` このコマンドは、最新のコミュニティ版に必要なすべてのプラグインをダウンロードしてインストールします。ターミナルに `Install plugins completed.` と表示されたら、移行は完了です。 @@ -132,7 +148,7 @@ It will be automatically generated by the script. エラーを見つけたり提案がありますか?お知らせください diff --git a/zh-hans/development/migration/migrate-to-v1.mdx b/zh-hans/development/migration/migrate-to-v1.mdx index 1ec530ea..1986cef0 100644 --- a/zh-hans/development/migration/migrate-to-v1.mdx +++ b/zh-hans/development/migration/migrate-to-v1.mdx @@ -1,5 +1,5 @@ --- -title: 将社区版升级至 v1.0.0 +title: 将社区版升级至 v1.0.0+ --- @@ -46,10 +46,16 @@ docker compose -f docker-compose.yaml up -d ``` ### 3. 工具迁移为插件 - + +> **重要提示:关于命令执行和包管理** +> * **默认容器名称:** `docker exec` 命令示例使用了 `docker-api-1`。如果您的 API 容器有不同的名称或 ID(您可以使用 `docker ps` 查找),请相应调整命令。 +> * **Python 包管理器 (`uv` 与 `poetry`):** + * 从版本 [v1.3.0](https://github.com/langgenius/dify/releases/tag/1.3.0) 开始,Dify 已将 Python 包管理器从 `poetry` 切换到 `uv` 以提升性能。对于 Dify v1.3.0 或更新版本中的常规操作,标准命令是 `uv run flask ...`。 + * **本指南专注于升级到 Dify v1.0.0。** 在 Dify v1.0.0 到 v1.3.0 (不含v1.3.0) 期间,`poetry` 是其包管理器。因此,下方示例中的 `flask` 命令正确地使用了 `poetry run ...`。代码示例首先在注释中强调了当前 `uv` 的标准用法,然后显示了与本指南特定的 v1.0.0 迁移范围相关的 `poetry` 命令。 + 该步骤的目的:将此前社区版本所使用的工具及模型供应商,自动进行数据迁移并安装至新版本的插件环境中。 -1. 运行 docker ps 命令,查看 docker-api 容器 id 号。 +1. 运行 `docker ps` 命令,查看 API 容器的名称或 ID。默认名称通常是 `docker-api-1`。 示例: @@ -61,20 +67,28 @@ f84aa773**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi a3cb19c2**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi…" 3 hours ago Up 3 hours 5001/tcp docker-api-1 ``` -运行命令 `docker exec -it a3cb19c2**** bash` 进入容器终端,在容器内运行: +运行命令 `docker exec -it docker-api-1 bash` 进入容器终端(如果您的容器名称不同,请使用对应的名称),在容器内运行: ```bash -poetry run flask extract-plugins --workers=20 +# 对于 Dify v1.3.0+ 的环境,标准命令是 'uv run ...'。 +uv run flask extract-plugins --workers=20 +# +# 如果您的目标迁移版本是 Dify v1.0.0 至 v1.3.0 (不含v1.3.0) 之间,请使用 'poetry': +# poetry run flask extract-plugins --workers=20 ``` -> 如果提示报错,建议参考前置准备,先在服务器内安装 `poetry` 环境;运行命令后,若终端出现待输入项,点击 **“回车”** 跳过输入。 +> 如果在按照本指南为 v1.0.0 版本迁移执行命令时发生错误(例如,找不到 `uv` 或 `poetry`),请确保按照该版本最初的先决条件,在服务器上正确设置了 `poetry` 环境。如果在运行 `poetry` 命令后终端提示输入,请按 **"回车"** 跳过。 此命令将提取当前环境中使用的所有模型和工具。workers 参数将决定提取过程中的所使用的并行进程数,可根据需要进行调整。命令运行完成后将生成 `plugins.jsonl` 文件保存结果,该文件包含了当前 Dify 实例中所有工作区的插件信息。 确保你的网络正常访问公网,并支持访问:`https://marketplace.dify.ai`。在 `docker-api-1` 容器内继续运行以下命令: ```bash -poetry run flask install-plugins --workers=2 +# 对于 Dify v1.3.0+ 的环境,标准命令是 'uv run ...'。 +uv run flask install-plugins --workers=2 +# +# 如果您的目标迁移版本是 Dify v1.0.0 至 v1.3.0 (不含v1.3.0) 之间,请使用 'poetry': +# poetry run flask install-plugins --workers=2 ``` 此命令将下载并安装所有必要的插件到最新的社区版本中。 @@ -82,7 +96,11 @@ poetry run flask install-plugins --workers=2 最后迁移插件数据。运行以下命令更新 `provider name`,并在其后附加 `langgenius/{provider_name}/{provider_name}`。 ```bash -poetry run flask migrate-data-for-plugin +# 对于 Dify v1.3.0+ 的环境,标准命令是 'uv run ...'。 +uv run flask migrate-data-for-plugin +# +# 如果您的目标迁移版本是 Dify v1.0.0 至 v1.3.0 (不含v1.3.0) 之间,请使用 'poetry': +# poetry run flask migrate-data-for-plugin ``` 当终端出现以下标识时,迁移完成。 @@ -94,7 +112,7 @@ Migrate data for plugin completed. ## 验证结果 -访问 Dify 平台,轻点右上角 **“插件”** 查看此前所使用的工具是否被正确安装。随机使用某个插件,验证是否能够正常运行。如果无误,说明你已完成版本升级和数据迁移。 +访问 Dify 平台,轻点右上角 **"插件"** 查看此前所使用的工具是否被正确安装。随机使用某个插件,验证是否能够正常运行。如果无误,说明你已完成版本升级和数据迁移。 ![](https://assets-docs.dify.ai/2025/02/6467b3578d3d3e96510f50a09442d5a5.png) diff --git a/zh-hans/getting-started/dify-premium.mdx b/zh-hans/getting-started/dify-premium.mdx index 3fd0800a..8a7344b0 100644 --- a/zh-hans/getting-started/dify-premium.mdx +++ b/zh-hans/getting-started/dify-premium.mdx @@ -27,9 +27,11 @@ docker-compose pull docker-compose -f docker-compose.yaml -f docker-compose.override.yaml up -d ``` - + -> 版本 v1.0.0 包含插件功能,详细介绍请参考[此处](https://github.com/langgenius/dify/releases/tag/1.0.0)。 +> 本节介绍将旧社区版迁移到 Dify v1.0.0+ 的方法。对于将 Dify Premium 或社区版升级到此特定迁移范围*之后*的版本,请参考它们各自主要的升级说明。 + +> 版本 v1.0.0+ 包含插件功能,详细介绍请参考[此处](https://github.com/langgenius/dify/releases/tag/1.0.0) (v1.0.0 Release) 和 [v1.3.0 Release Notes](https://github.com/langgenius/dify/releases/tag/1.3.0) (关于uv切换)。 升级分为以下步骤: @@ -66,10 +68,16 @@ docker compose -f docker-compose.yaml up -d ``` ### 3. 工具迁移为插件 - + +> **关于命令执行和包管理的重要提示(针对v1.0.0迁移):** +> * **默认容器名称:** `docker exec` 命令示例使用了 `docker-api-1`。如果您的 API 容器有不同的名称或 ID(您可以使用 `docker ps` 查找),请相应调整命令。 +> * **Python 包管理器 (`uv` 与 `poetry`):** + * 从版本 [v1.3.0](https://github.com/langgenius/dify/releases/tag/1.3.0) 开始,Dify 已将 Python 包管理器从 `poetry` 切换到 `uv` 以提升性能。对于 Dify v1.3.0 或更新版本中的常规操作,标准命令是 `uv run flask ...`。 + * **本特定章节专注于升级到 Dify v1.0.0。** 在 Dify v1.0.0 到 v1.3.0 (不含v1.3.0) 期间,`poetry` 是其包管理器。因此,下方示例中的 `flask` 命令正确地使用了 `poetry run ...`。代码示例首先在注释中强调了当前 `uv` 的标准用法,然后显示了与本特定 v1.0.0 迁移范围相关的 `poetry` 命令。 + 该步骤的目的:将此前社区版本所使用的工具及模型供应商,自动进行数据迁移并安装至新版本的插件环境中。 -1. 运行 docker ps 命令,查看 docker-api 容器 id 号。 +1. 运行 `docker ps` 命令,查看 API 容器的名称或 ID。默认名称通常是 `docker-api-1`。 示例: @@ -77,23 +85,32 @@ docker compose -f docker-compose.yaml up -d docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 417241cd**** nginx:latest "sh -c 'cp /docker-e…" 3 hours ago Up 3 hours 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp docker-nginx-1 +f84aa773**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi…" 3 hours ago Up 3 hours 5001/tcp docker-worker-1 a3cb19c2**** langgenius/dify-api:1.0.0 "/bin/bash /entrypoi…" 3 hours ago Up 3 hours 5001/tcp docker-api-1 ``` -运行命令 `docker exec -it a3cb19c2**** bash` 进入容器终端,在容器内运行: +运行命令 `docker exec -it docker-api-1 bash` 进入容器终端(如果您的容器名称不同,请使用对应的名称),在容器内运行: ```bash -poetry run flask extract-plugins --workers=20 +# 对于 Dify v1.3.0+ 的环境,标准命令是 'uv run ...'。 +uv run flask extract-plugins --workers=20 +# +# 如果您此处描述的社区版部分的迁移目标版本是 Dify v1.0.0 至 v1.3.0 (不含v1.3.0) 之间,请使用 'poetry': +# poetry run flask extract-plugins --workers=20 ``` -> 如果提示报错,建议参考前置准备,先在服务器内安装 `poetry` 环境;运行命令后,若终端出现待输入项,点击 **“回车”** 跳过输入。 +> 如果在按照本指南为 v1.0.0 版本迁移执行命令时发生错误(例如,找不到 `uv` 或 `poetry`),请确保按照该版本最初的先决条件,在服务器上正确设置了 `poetry` 环境。如果在运行 `poetry` 命令后终端提示输入,请按 **"回车"** 跳过。 此命令将提取当前环境中使用的所有模型和工具。workers 参数将决定提取过程中的所使用的并行进程数,可根据需要进行调整。命令运行完成后将生成 `plugins.jsonl` 文件保存结果,该文件包含了当前 Dify 实例中所有工作区的插件信息。 确保你的网络正常访问公网,并支持访问:`https://marketplace.dify.ai`。在 `docker-api-1` 容器内继续运行以下命令: ```bash -poetry run flask install-plugins --workers=2 +# 对于 Dify v1.3.0+ 的环境,标准命令是 'uv run ...'。 +uv run flask install-plugins --workers=2 +# +# 如果您此处描述的社区版部分的迁移目标版本是 Dify v1.0.0 至 v1.3.0 (不含v1.3.0) 之间,请使用 'poetry': +# poetry run flask install-plugins --workers=2 ``` 此命令将下载并安装所有必要的插件到最新的社区版本中。当终端出现 `Install plugins completed.` 标识时,迁移完成。