mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-26 13:18:34 +07:00
doc: zh_hans draft for plugin multilingual readme std (#472)
* doc: zh_hans draft for plugin multilingual readme std * Docs tools: Successfully completed 3 operations * Documentation edits made through Mintlify web editor * Docs tools: 2 succeeded, some failed Rename operation failed: - Lang 'zh': File 'dify-docs/plugin-dev-zh/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'zh': File 'dify-docs/plugin-dev-zh/0411-multilingual-readme.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'en': File 'dify-docs/plugin-dev-en/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'en': File 'dify-docs/plugin-dev-en/0411-multilingual-readme.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'ja': File 'dify-docs/plugin-dev-ja/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'ja': File 'dify-docs/plugin-dev-ja/0411-multilingual-readme.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' * Documentation edits made through Mintlify web editor * Docs tools: 2 succeeded, some failed Rename operation failed: - Lang 'zh': File 'dify-docs/plugin-dev-zh/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'zh': File 'dify-docs/plugin-dev-zh/0411-multilingual-readme.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'en': File 'dify-docs/plugin-dev-en/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'en': File 'dify-docs/plugin-dev-en/0411-multilingual-readme.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'ja': File 'dify-docs/plugin-dev-ja/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'ja': File 'dify-docs/plugin-dev-ja/0411-multilingual-readme.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' * Documentation edits made through Mintlify web editor * Docs tools: 2 succeeded, some failed Rename operation failed: - Lang 'zh': File 'dify-docs/plugin-dev-zh/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'zh': File 'dify-docs/plugin-dev-zh/0411-multilingual-readme.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'en': File 'dify-docs/plugin-dev-en/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'en': File 'dify-docs/plugin-dev-en/0411-multilingual-readme.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'ja': File 'dify-docs/plugin-dev-ja/0211-getting-started-dify-tool.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' - Lang 'ja': File 'dify-docs/plugin-dev-ja/0411-multilingual-readme.mdx' - Renaming error: Unexpected error: 'str' object has no attribute 'get' * Documentation edits made through Mintlify web editor --------- Co-authored-by: alterxyz <88554920+alterxyz@users.noreply.github.com> Co-authored-by: Riskey <36894937+RiskeyL@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
95ab596360
commit
fe4d97fae3
@@ -597,7 +597,8 @@
|
||||
"plugin-dev-en/0411-plugin-info-by-manifest",
|
||||
"plugin-dev-en/0411-remote-debug-a-plugin",
|
||||
"plugin-dev-en/0411-tool",
|
||||
"plugin-dev-en/0412-model-schema"
|
||||
"plugin-dev-en/0412-model-schema",
|
||||
"plugin-dev-en/0411-multilingual-readme"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -1283,7 +1284,8 @@
|
||||
"plugin-dev-zh/0411-plugin-info-by-manifest",
|
||||
"plugin-dev-zh/0411-remote-debug-a-plugin",
|
||||
"plugin-dev-zh/0411-tool",
|
||||
"plugin-dev-zh/0412-model-schema"
|
||||
"plugin-dev-zh/0412-model-schema",
|
||||
"plugin-dev-zh/0411-multilingual-readme"
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -1936,7 +1938,8 @@
|
||||
"plugin-dev-ja/0411-plugin-info-by-manifest",
|
||||
"plugin-dev-ja/0411-remote-debug-a-plugin",
|
||||
"plugin-dev-ja/0411-tool",
|
||||
"plugin-dev-ja/0412-model-schema"
|
||||
"plugin-dev-ja/0412-model-schema",
|
||||
"plugin-dev-ja/0411-multilingual-readme"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
BIN
images/plugin_details_page_en.jpeg
Normal file
BIN
images/plugin_details_page_en.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 435 KiB |
BIN
images/plugin_details_page_jp.jpeg
Normal file
BIN
images/plugin_details_page_jp.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 462 KiB |
BIN
images/plugin_details_page_zh.jpg
Normal file
BIN
images/plugin_details_page_zh.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 422 KiB |
@@ -1,17 +1,9 @@
|
||||
---
|
||||
dimensions:
|
||||
type:
|
||||
primary: implementation
|
||||
detail: basic
|
||||
level: beginner
|
||||
standard_title: Getting Started Dify Tool
|
||||
language: en
|
||||
title: 'Dify Plugin Development: Hello World Guide'
|
||||
description: This document provides a detailed tutorial for Dify plugin development
|
||||
from scratch, using the Telegraph publishing plugin as an example, covering environment
|
||||
preparation, project initialization, virtual environment configuration, plugin core
|
||||
logic development, local debugging, plugin metadata enhancement, and packaging for
|
||||
release.
|
||||
dimensions: "[object Object]"
|
||||
standard_title: "Getting Started Dify Tool"
|
||||
language: "en"
|
||||
title: "Dify Plugin Development: Hello World Guide"
|
||||
description: "This document provides a detailed tutorial for Dify plugin development from scratch, using the Telegraph publishing plugin as an example, covering environment preparation, project initialization, virtual environment configuration, plugin core logic development, local debugging, plugin metadata enhancement, and packaging for release."
|
||||
---
|
||||
|
||||
Welcome to the beginner's guide for Dify plugin development! This tutorial assumes you have basic programming knowledge and experience using the Dify platform. After completing this tutorial, you will master the fundamental process of creating a simple Dify plugin, taking you from a Dify user to a plugin contributor.
|
||||
@@ -35,24 +27,19 @@ Before starting Dify plugin development, ensure you have the following tools rea
|
||||
|
||||
1. **Download:** Visit the [Dify Plugin CLI Releases](https://github.com/langgenius/dify-plugin-daemon/releases) page. Download the latest version of the binary file corresponding to your operating system (Windows, macOS Intel/ARM, Linux).
|
||||
2. **Set Execute Permissions (macOS / Linux):**
|
||||
|
||||
- **The following steps use macOS (Apple Silicon / M series chips) as an example**, assuming the downloaded file is named `dify-plugin-darwin-arm64`. In the terminal, navigate to the directory containing the file and execute the following command to grant execution permissions:
|
||||
|
||||
```bash
|
||||
chmod +x dify-plugin-darwin-arm64
|
||||
```
|
||||
|
||||
- For Linux users, download the corresponding Linux version file and execute a similar command like `chmod +x <downloaded_filename>`.
|
||||
- For Windows users, after downloading the `.exe` file, you can typically run it directly.
|
||||
|
||||
3. **Verify Installation:**
|
||||
|
||||
- In the terminal, execute the following command to check if the tool runs properly (replace `./dify-plugin-darwin-arm64` with the actual filename or path you downloaded):
|
||||
|
||||
```bash
|
||||
./dify-plugin-darwin-arm64 version
|
||||
```
|
||||
|
||||
- If the terminal successfully outputs version information (e.g., `v0.0.1-beta.15`), then the installation is successful.
|
||||
|
||||
> **Tips:**
|
||||
@@ -63,7 +50,7 @@ Before starting Dify plugin development, ensure you have the following tools rea
|
||||
> - For example (macOS/Linux): `sudo mv dify /usr/local/bin/`
|
||||
> - After configuration, typing `dify version` directly in the terminal should successfully output the version number.
|
||||
|
||||
**For convenience, this article will use `./dify` as an example command for the Dify plugin development scaffold. Please replace it with your corresponding command based on your actual situation.**
|
||||
**`For convenience, this article will use ./dify as an example command for the Dify plugin development scaffold. Please replace it with your corresponding command based on your actual situation.`**
|
||||
|
||||
## 2. Initializing the Plugin Project
|
||||
|
||||
@@ -74,13 +61,13 @@ Now, let's use the scaffold tool to create a new plugin project.
|
||||
```bash
|
||||
./dify plugin init
|
||||
```
|
||||
|
||||
2. Enter the basic information for the plugin according to the prompts:
|
||||
- **Plugin name:** A unique identifier for the plugin. For example: `telegraph`
|
||||
- _Constraints: 1-128 characters, can only contain lowercase letters, numbers, hyphens (-), and underscores (_)._
|
||||
- _Constraints: 1-128 characters, can only contain lowercase letters, numbers, hyphens (-), and underscores (_).\_
|
||||
- **Author:** The identifier for the plugin author. For example: `your-name`
|
||||
- _Constraints: 1-64 characters, can only contain lowercase letters, numbers, hyphens (-), and underscores (_)._
|
||||
- _Constraints: 1-64 characters, can only contain lowercase letters, numbers, hyphens (-), and underscores (_).\_
|
||||
- **Description:** A brief description of the plugin's functionality. For example: `A Telegraph plugin that allows you to publish your content easily`
|
||||
- **Enable multilingual README:** This option allows the generation of multilingual README files for the plugin. After checking this, you can select the languages for which you want to pre-generate README files in the `Languages to generate` section below.
|
||||
3. **Select Development Language:** When prompted `Select language`, choose `python`.
|
||||
4. **Select Plugin Type:** When prompted `Select plugin type`, for this tutorial, choose `tool`.
|
||||
5. **Select Additional Features:** Next, you'll be prompted if you need to include Provider validation, persistent storage, and other additional features. For this simple Hello World plugin, we don't need these yet, so you can press **Enter** to skip all options until you see the success message.
|
||||
@@ -105,33 +92,27 @@ This is the **recommended and universal** method, not dependent on any specific
|
||||
```bash
|
||||
cd telegraph
|
||||
```
|
||||
|
||||
2. **Create a Virtual Environment:** (Recommended to name it `venv`)
|
||||
|
||||
```bash
|
||||
python -m venv venv
|
||||
```
|
||||
|
||||
3. **Activate the Virtual Environment:**
|
||||
|
||||
- **macOS / Linux:**
|
||||
|
||||
```bash
|
||||
source venv/bin/activate
|
||||
```
|
||||
|
||||
- **Windows (cmd.exe):**
|
||||
|
||||
```bash
|
||||
venv\Scripts\activate.bat
|
||||
```
|
||||
|
||||
- **Windows (PowerShell):**
|
||||
|
||||
```bash
|
||||
venv\Scripts\Activate.ps1
|
||||
```
|
||||
|
||||
- After successful activation, your terminal prompt will typically display `(venv)` at the beginning.
|
||||
|
||||
### 3.2 Installing Basic Dependencies
|
||||
@@ -155,7 +136,7 @@ If you use VSCode as your code editor, you can leverage its integrated features
|
||||
3. **Install Dependencies (If VSCode Prompts):** VSCode may detect the `requirements.txt` file and prompt you to install its dependencies. If prompted, confirm the installation.
|
||||
- _(Please refer to your local corresponding screenshot, which shows the interface for confirming dependency installation)_
|
||||
|
||||
**Please ensure that all subsequent `pip install` commands and running `python -m main` operations are performed in the activated virtual environment.**
|
||||
**`Please ensure that all subsequent pip install commands and running python -m main operations are performed in the activated virtual environment.`**
|
||||
|
||||
## 4. Developing the Plugin Core Logic
|
||||
|
||||
@@ -190,8 +171,7 @@ Our goal is to implement similar functionality in a Dify plugin.
|
||||
```bash
|
||||
pip install your-telegraph
|
||||
```
|
||||
|
||||
2. **Update `requirements.txt`:** Open the `requirements.txt` file in the `telegraph` project root directory, and add a line below `dify_plugin` with the name of the library you just installed:
|
||||
2. **`Update requirements.txt:`** Open the `requirements.txt` file in the `telegraph` project root directory, and add a line below `dify_plugin` with the name of the library you just installed:
|
||||
|
||||
```plaintext
|
||||
dify_plugin
|
||||
@@ -205,7 +185,7 @@ Our goal is to implement similar functionality in a Dify plugin.
|
||||
Our example requires a `telegraph_access_token`. We need to define this credential in the Provider configuration so that users can input it when using the plugin. For more information about Provider configuration, please refer to [General Specification Definitions](/plugin-dev-en/0411-general-specifications).
|
||||
|
||||
1. **Edit the Provider YAML:** Open the `telegraph/provider/telegraph.yaml` file.
|
||||
2. **Add `credentials_for_provider`:** Add the following content at the end of the file (or at an appropriate location):
|
||||
2. **`Add credentials_for_provider:`** Add the following content at the end of the file (or at an appropriate location):
|
||||
|
||||
```yaml
|
||||
# ... (keep existing identity, name, label, description, icon, etc. unchanged) ...
|
||||
@@ -228,7 +208,6 @@ Our example requires a `telegraph_access_token`. We need to define this credenti
|
||||
# ... (other languages)
|
||||
url: https://telegra.ph/api#createAccount # URL to jump to when clicking the help prompt
|
||||
```
|
||||
|
||||
- **Field Explanations:**
|
||||
- `telegraph_access_token`: Unique identifier for the credential, accessed in code via `self.runtime.credentials["telegraph_access_token"]`.
|
||||
- `type: secret-input`: Indicates that it will be displayed as a password input field in the Dify interface.
|
||||
@@ -241,7 +220,7 @@ Our example requires a `telegraph_access_token`. We need to define this credenti
|
||||
Now let's write the code that actually performs the publishing operation.
|
||||
|
||||
1. **Edit the Tool Python File:** Open `telegraph/tools/telegraph.py`.
|
||||
2. **Implement the `_invoke` Method:** Replace the file contents with the following code:
|
||||
2. **`Implement the _invoke Method:`** Replace the file contents with the following code:
|
||||
|
||||
```python
|
||||
from collections.abc import Generator
|
||||
@@ -296,7 +275,6 @@ Now let's write the code that actually performs the publishing operation.
|
||||
# Use create_link_message to generate an output message containing a link
|
||||
yield self.create_link_message(ph_link)
|
||||
```
|
||||
|
||||
- **Key Points:**
|
||||
- Get credentials from `self.runtime.credentials`.
|
||||
- Get the tool's input parameters from `tool_parameters` (parameter names will be defined in YAML in the next step). Using `.get()` is a more robust approach.
|
||||
@@ -355,15 +333,14 @@ We need to tell Dify which input parameters this tool accepts.
|
||||
python:
|
||||
source: tools/telegraph.py # Points to the Python file implementing the tool logic
|
||||
```
|
||||
|
||||
- **Field Explanations:**
|
||||
- `identity`: Basic information about the tool, `name` is a unique identifier.
|
||||
- `description`: Divided into `human` (for users) and `llm` (for Agent). **The `llm` description is crucial for the Agent to correctly understand and use the tool.**
|
||||
- `description`: Divided into `human` (for users) and `llm` (for Agent). **`The llm description is crucial for the Agent to correctly understand and use the tool.`**
|
||||
- `parameters`: Defines each input parameter.
|
||||
- `name`: Internal name, must match the key in the Python code's `tool_parameters.get("...")`.
|
||||
- `type`: Data type (such as `string`, `number`, `boolean`, etc.).
|
||||
- `required`: Whether it must be provided.
|
||||
- `label`, `human_description`, `llm_description`: Similar to descriptions in `identity`, but for specific parameters. **`llm_description` should clearly guide the LLM on how to generate or obtain the parameter value, including format requirements (such as Markdown here).**
|
||||
- `label`, `human_description`, `llm_description`: Similar to descriptions in `identity`, but for specific parameters. **`llm_description should clearly guide the LLM on how to generate or obtain the parameter value, including format requirements (such as Markdown here).`**
|
||||
- `form`: Defines how the parameter is presented and filled in Dify. `llm` indicates that the parameter value can be input by the user, passed through variables, or determined by the LLM in Agent mode; `form` typically indicates a configuration item that needs to be fixed by the user in the interface. For tool inputs, `llm` is more common.
|
||||
- `extra.python.source`: Specifies the path to the Python file implementing this tool's logic (relative to the project root directory).
|
||||
|
||||
@@ -372,7 +349,7 @@ We need to tell Dify which input parameters this tool accepts.
|
||||
To ensure that the credentials provided by users are valid, we should implement validation logic.
|
||||
|
||||
1. **Edit the Provider Python File:** Open `telegraph/provider/telegraph.py`.
|
||||
2. **Implement the `_validate_credentials` Method:** Replace the file contents with:
|
||||
2. **`Implement the _validate_credentials Method:`** Replace the file contents with:
|
||||
|
||||
```python
|
||||
from typing import Any
|
||||
@@ -404,7 +381,6 @@ To ensure that the credentials provided by users are valid, we should implement
|
||||
raise ToolProviderCredentialValidationError(f"Telegraph credential validation failed: {e}")
|
||||
|
||||
```
|
||||
|
||||
- **Key Points:**
|
||||
- Get the credentials from the `credentials` dictionary.
|
||||
- Perform an API call that requires the credential (preferably a read-only operation like getting account information; if not available, creating a harmless test page is also acceptable, but be aware of potential side effects).
|
||||
@@ -415,50 +391,41 @@ To ensure that the credentials provided by users are valid, we should implement
|
||||
|
||||
Now you can run the plugin locally and debug it in Dify.
|
||||
|
||||
1. **Prepare the `.env` File:**
|
||||
|
||||
1. **`Prepare the .env File:`**
|
||||
- Make sure you're still in the `telegraph` project directory.
|
||||
- Copy the environment variable template file:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
- **Edit the `.env` File:** Open the `.env` file you just created and fill in your Dify environment information:
|
||||
- **`Edit the .env File:`** Open the `.env` file you just created and fill in your Dify environment information:
|
||||
|
||||
```dotenv
|
||||
DIFY_API_HOST=https://your-dify-host.com # Replace with your Dify instance address (e.g., https://cloud.dify.ai)
|
||||
DIFY_API_KEY=your-api-key # Replace with your Dify API key
|
||||
```
|
||||
|
||||
- **Get Host and Key:** Log in to your Dify environment, click the "Plugins" icon in the top right corner, then click the debug icon (or something that looks like a bug). In the pop-up window, copy the "API Key" and "Host Address". _(Please refer to your local corresponding screenshot, which shows the interface for obtaining the key and host address)_
|
||||
|
||||
2. **Start the Local Plugin Service:**
|
||||
|
||||
- Ensure your Python virtual environment is activated.
|
||||
- In the `telegraph` directory, run the main program:
|
||||
|
||||
```bash
|
||||
python -m main
|
||||
```
|
||||
|
||||
- **Observe Terminal Output:** If everything is normal, you should see log information similar to the following, indicating that the plugin tool has been successfully loaded and connected to Dify:
|
||||
|
||||
```json
|
||||
{"event": "log", "data": {"level": "INFO", "message": "Installed tool: telegraph_publisher", "timestamp": 1678886400.123456}}
|
||||
{"event": "log", "data": {"level": "INFO", "message": "Plugin daemon started, waiting for requests...", "timestamp": 1678886400.123457}}
|
||||
```
|
||||
|
||||
3. **View and Test in Dify:**
|
||||
|
||||
- **Refresh the Dify Page:** Return to your Dify environment (in the browser), refresh the plugin management page (typically `https://your-dify-host.com/plugins`).
|
||||
- **Find the Plugin:** You should see a plugin named "Telegraph" (or the `label` you defined in the Provider YAML) in the list, possibly with a "Debugging" mark.
|
||||
- **Add Credentials:** Click on the plugin, and you'll be prompted to enter the "Telegraph Access Token" you defined earlier in `provider/telegraph.yaml`. Enter a valid token and save. If your validation logic (`_validate_credentials`) is implemented correctly, validation will be performed here. _(Please refer to your local corresponding screenshot, which shows the plugin appearing in the list and requesting authorization)_
|
||||
- **Use in Applications:** Now, you can add this tool node in Dify applications (such as Chatbot or Workflow) and try to call it! When you run the application and trigger the tool, the request will be forwarded to your local `python -m main` process for processing. You can see related log output in your local terminal for debugging.
|
||||
|
||||
4. **Stop the Local Service:** Press `Ctrl + C` in the terminal to stop the local plugin service.
|
||||
|
||||
This run -> test -> stop -> modify code -> run again cycle is the main workflow for plugin development.
|
||||
This run -\> test -\> stop -\> modify code -\> run again cycle is the main workflow for plugin development.
|
||||
|
||||
## 6. Enhancing Plugin Metadata
|
||||
|
||||
@@ -466,8 +433,7 @@ To make the plugin more professional, discoverable, and understandable, we need
|
||||
|
||||
1. **Icon:**
|
||||
- Place an icon file representing your plugin in the `telegraph/_assets` directory (e.g., `icon.png`, `icon.svg`). Square, clear images are recommended.
|
||||
2. **Provider Information (`provider/telegraph.yaml`):**
|
||||
|
||||
2. **`Provider Information (provider/telegraph.yaml):`**
|
||||
- Ensure that the `label` (display name), `description` (function description), and `icon` (icon filename, such as `icon.png`) in the `identity` section are filled in and support multiple languages. This information is primarily displayed to users who _use_ the plugin in the Dify application orchestration interface.
|
||||
|
||||
```yaml
|
||||
@@ -482,9 +448,7 @@ To make the plugin more professional, discoverable, and understandable, we need
|
||||
zh_Hans: A Telegraph plugin that allows you to publish your content easily
|
||||
icon: icon.png # Reference to the icon filename in the _assets directory
|
||||
```
|
||||
|
||||
3. **Plugin Manifest (`manifest.yaml`):**
|
||||
|
||||
3. **`Plugin Manifest (manifest.yaml):`**
|
||||
- Edit the `manifest.yaml` file in the project root directory. This is the "ID card" for the entire plugin, and its information will be displayed on the **plugin management page** and **Plugin Marketplace** in Dify.
|
||||
- Be sure to update or confirm the following fields:
|
||||
- `label`: The **main display name** of the plugin (supports multiple languages).
|
||||
@@ -503,9 +467,12 @@ To make the plugin more professional, discoverable, and understandable, we need
|
||||
tags: ['media', 'content-creation'] # Example tags
|
||||
# ... (Keep other fields like author, name unchanged)
|
||||
```
|
||||
|
||||
4. **README and Privacy Policy:**
|
||||
- `README.md`: Edit the `README.md` file in the project root directory. It will serve as the detailed introduction page for the plugin on the **Marketplace**, and should include richer information such as detailed functionality, usage examples, configuration guide, frequently asked questions, etc. You can refer to the style of the [AWS plugin marketplace page](https://marketplace.dify.ai/plugins/langgenius/aws_tools).
|
||||
|
||||
<Info>
|
||||
You can provide READMEs in multiple languages. For more information, see [Multilingual READMEs](/plugin-dev-en/0411-multilingual-readme).
|
||||
</Info>
|
||||
- `PRIVACY.md`: If you plan to publish the plugin to the official Marketplace, you need to provide a privacy policy document `PRIVACY.md`, describing how the plugin handles data.
|
||||
|
||||
## 7. Packaging the Plugin
|
||||
@@ -517,7 +484,6 @@ When plugin development is complete and passes local testing, you can package it
|
||||
```bash
|
||||
cd ..
|
||||
```
|
||||
|
||||
2. **Execute the Packaging Command:**
|
||||
|
||||
```bash
|
||||
@@ -525,7 +491,6 @@ When plugin development is complete and passes local testing, you can package it
|
||||
```
|
||||
|
||||
(Replace `./telegraph` with the actual path to your plugin project)
|
||||
|
||||
3. **Get the Package File:** After successful execution, a file named `telegraph.difypkg` (or `your_plugin_name.difypkg`) will be generated in the current directory.
|
||||
|
||||
This `.difypkg` file is a complete plugin package. You can:
|
||||
|
||||
51
plugin-dev-en/0411-multilingual-readme.mdx
Normal file
51
plugin-dev-en/0411-multilingual-readme.mdx
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
dimensions:
|
||||
type:
|
||||
primary: reference
|
||||
detail: core
|
||||
level: beginner
|
||||
standard_title: Multilingual README
|
||||
language: en
|
||||
title: Multilingual README
|
||||
description: This article introduces the file specifications for Dify plugins' multilingual READMEs and their display rule in Dify Marketplace.
|
||||
---
|
||||
|
||||
You can create multilingual READMEs for your plugin, which will be displayed in [Dify Marketplace](https://marketplace.dify.ai) and other locations based on the user's preferred language.
|
||||
|
||||
### README **File Specifications**
|
||||
|
||||
| **Language** | Required | Filename | Path | **Description** |
|
||||
| :------------------ | :------- | :-------------------------- | :----------------------------------------------------- | :--------------------------------------------------------------- |
|
||||
| **English** | Yes | `README.md` | Plugin root directory | / |
|
||||
| **Other Languages** | No | `README_<language_code>.md` | In the `readme` folder under the plugin root directory | Currently supports Japanese, Portuguese, and Simplified Chinese. |
|
||||
|
||||
Here's an example of the directory structure:
|
||||
|
||||
```bash
|
||||
...
|
||||
├── main.py
|
||||
├── manifest.yaml
|
||||
├── readme
|
||||
│ ├── README_ja_JP.md
|
||||
│ ├── README_pt_BR.md
|
||||
│ └── README_zh_Hans.md
|
||||
├── README.md
|
||||
...
|
||||
```
|
||||
|
||||
### How Multilingual READMEs are Displayed **in Marketplace**
|
||||
|
||||
When your plugin has a README in the user's preferred language, the plugin's detail page in Dify Marketplace will display that language version of the README.
|
||||
|
||||

|
||||
|
||||
{/*
|
||||
Contributing Section
|
||||
DO NOT edit this section!
|
||||
It will be automatically generated by the script.
|
||||
*/}
|
||||
|
||||
---
|
||||
|
||||
[Edit this page](https://github.com/langgenius/dify-docs/edit/main/plugin-dev-en/0411-multilingual-readme.mdx) | [Report an issue](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml)
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
---
|
||||
dimensions:
|
||||
type:
|
||||
primary: implementation
|
||||
detail: basic
|
||||
level: beginner
|
||||
standard_title: Getting Started Dify Tool
|
||||
language: ja
|
||||
title: Dify プラグイン開発:Hello World ガイド
|
||||
description: このドキュメントでは、Telegraph公開プラグインの作成を例に、ゼロからのDifyプラグイン開発に関する詳細なチュートリアルを提供します。環境準備、プロジェクト初期化、仮想環境設定、プラグインコアロジック開発、ローカル実行デバッグ、プラグインメタ情報整備、パッケージ化と公開といった手順が含まれます。
|
||||
dimensions: "[object Object]"
|
||||
standard_title: "Getting Started Dify Tool"
|
||||
language: "ja"
|
||||
title: "Dify プラグイン開発:Hello World ガイド"
|
||||
description: "このドキュメントでは、Telegraph公開プラグインの作成を例に、ゼロからのDifyプラグイン開発に関する詳細なチュートリアルを提供します。環境準備、プロジェクト初期化、仮想環境設定、プラグインコアロジック開発、ローカル実行デバッグ、プラグインメタ情報整備、パッケージ化と公開といった手順が含まれます。"
|
||||
---
|
||||
|
||||
Dify プラグイン開発入門ガイドへようこそ!このチュートリアルは、基本的なプログラミング知識と Dify プラットフォームの使用経験があることを前提としています。このチュートリアルを完了すると、簡単な Dify プラグインを作成するための基本的な流れを習得し、Dify ユーザーからプラグイン貢献者へとステップアップできます。
|
||||
@@ -31,24 +27,19 @@ Dify プラグインの開発を始める前に、お使いの環境に以下の
|
||||
|
||||
1. **ダウンロード:** [Dify Plugin CLI Releases](https://github.com/langgenius/dify-plugin-daemon/releases) ページにアクセスします。お使いのオペレーティングシステム(Windows, macOS Intel/ARM, Linux)に対応する最新バージョンのバイナリファイルをダウンロードします。
|
||||
2. **実行権限の設定 (macOS / Linux):**
|
||||
|
||||
- **以下の手順は macOS (Apple Silicon / M シリーズチップ) を例としています**。ダウンロードしたファイル名を `dify-plugin-darwin-arm64` と仮定します。ターミナルで、ファイルが存在するディレクトリに移動し、以下のコマンドを実行して実行権限を付与します:
|
||||
|
||||
```bash
|
||||
chmod +x dify-plugin-darwin-arm64
|
||||
```
|
||||
|
||||
- Linux ユーザーの場合は、対応する Linux バージョンのファイルをダウンロードし、同様の `chmod +x <downloaded_filename>` コマンドを実行してください。
|
||||
- Windows ユーザーの場合は、`.exe` ファイルをダウンロードした後、通常は直接実行できます。
|
||||
|
||||
3. **インストールの確認:**
|
||||
|
||||
- ターミナルで、以下のコマンドを実行してツールが正常に動作するか確認します(`./dify-plugin-darwin-arm64` をダウンロードした実際のファイル名またはパスに置き換えてください):
|
||||
|
||||
```bash
|
||||
./dify-plugin-darwin-arm64 version
|
||||
```
|
||||
|
||||
- ターミナルにバージョン情報(例:`v0.0.1-beta.15`)が正常に出力されれば、インストールは成功です。
|
||||
|
||||
> **ヒント (Tips):**
|
||||
@@ -59,7 +50,7 @@ Dify プラグインの開発を始める前に、お使いの環境に以下の
|
||||
> - 例 (macOS/Linux): `sudo mv dify /usr/local/bin/`
|
||||
> - 設定完了後、ターミナルで直接 `dify version` と入力すると、バージョン番号が正常に出力されるはずです。
|
||||
|
||||
**便宜上、このドキュメントでは以降、Dify プラグイン開発 CLI コマンドの例として `./dify` を使用します。ご自身の実際の状況に合わせてコマンドを置き換えてください。**
|
||||
**`便宜上、このドキュメントでは以降、Dify プラグイン開発 CLI コマンドの例として ./dify を使用します。ご自身の実際の状況に合わせてコマンドを置き換えてください。`**
|
||||
|
||||
## 2. プラグインプロジェクトの初期化
|
||||
|
||||
@@ -70,13 +61,13 @@ Dify プラグインの開発を始める前に、お使いの環境に以下の
|
||||
```bash
|
||||
./dify plugin init
|
||||
```
|
||||
|
||||
2. プロンプトに従って、プラグインの基本情報を順に入力します:
|
||||
- **Plugin name:** プラグインの一意の識別子。例:`telegraph`
|
||||
- _制約: 長さ 1~128 文字、小文字の英数字、ハイフン(-)、アンダースコア(_)のみ使用可能。_
|
||||
- _制約: 長さ 1~128 文字、小文字の英数字、ハイフン(-)、アンダースコア(_)のみ使用可能。\_
|
||||
- **Author:** プラグイン作者の識別子。例:`your-name`
|
||||
- _制約: 長さ 1~64 文字、小文字の英数字、ハイフン(-)、アンダースコア(_)のみ使用可能。_
|
||||
- _制約: 長さ 1~64 文字、小文字の英数字、ハイフン(-)、アンダースコア(_)のみ使用可能。\_
|
||||
- **Description:** プラグイン機能の簡単な説明。例:`A Telegraph plugin that allows you to publish your content easily`
|
||||
- **Enable multilingual README:** このオプションを有効にすると、プラグインの多言語READMEファイルを生成できます。チェックを入れると、下の `Languages to generate` セクションで、事前にREADMEファイルを生成したい言語を選択できます。
|
||||
3. **開発言語の選択:** `Select language` と表示されたら、`python` を選択してください。
|
||||
4. **プラグインタイプの選択:** `Select plugin type` と表示されたら、このチュートリアルでは `tool` を選択してください。
|
||||
5. **追加機能の選択:** 次に、プロバイダー認証、永続ストレージなどの追加機能が必要かどうか尋ねられます。この簡単な Hello World プラグインでは、これらは一時的に不要なので、成功メッセージが表示されるまで **Enter キー** を押してすべてのオプションをスキップできます。
|
||||
@@ -101,33 +92,27 @@ Dify プラグインの開発を始める前に、お使いの環境に以下の
|
||||
```bash
|
||||
cd telegraph
|
||||
```
|
||||
|
||||
2. **仮想環境の作成:** (名前を `venv` にすることを推奨します)
|
||||
|
||||
```bash
|
||||
python -m venv venv
|
||||
```
|
||||
|
||||
3. **仮想環境のアクティベート:**
|
||||
|
||||
- **macOS / Linux:**
|
||||
|
||||
```bash
|
||||
source venv/bin/activate
|
||||
```
|
||||
|
||||
- **Windows (cmd.exe):**
|
||||
|
||||
```bash
|
||||
venv\Scripts\activate.bat
|
||||
```
|
||||
|
||||
- **Windows (PowerShell):**
|
||||
|
||||
```bash
|
||||
venv\Scripts\Activate.ps1
|
||||
```
|
||||
|
||||
- アクティベートに成功すると、通常、ターミナルのプロンプトの前に `(venv)` と表示されます。
|
||||
|
||||
### 3.2 基本的な依存関係のインストール
|
||||
@@ -151,7 +136,7 @@ VSCode をコードエディタとして使用している場合、その統合
|
||||
3. **依存関係のインストール (VSCode が提示した場合):** VSCode が `requirements.txt` ファイルを検出し、その中の依存関係をインストールするよう促すことがあります。プロンプトが表示されたら、インストールを確認してください。
|
||||
- _(ローカルの対応するスクリーンショットを参照してください。依存関係のインストール確認画面が表示されています)_
|
||||
|
||||
**以降のすべての `pip install` コマンドと `python -m main` の実行操作は、アクティベートされた仮想環境で実行してください。**
|
||||
**``以降のすべての pip install コマンドと python -m main の実行操作は、アクティベートされた仮想環境で実行してください。``**
|
||||
|
||||
## 4. プラグインコアロジックの開発
|
||||
|
||||
@@ -186,8 +171,7 @@ print(ph_link)
|
||||
```bash
|
||||
pip install your-telegraph
|
||||
```
|
||||
|
||||
2. **`requirements.txt` の更新:** プロジェクトルートディレクトリにある `telegraph/requirements.txt` ファイルを開き、`dify_plugin` の下に、先ほどインストールしたライブラリ名を一行追加します:
|
||||
2. **`requirements.txt の更新:`** プロジェクトルートディレクトリにある `telegraph/requirements.txt` ファイルを開き、`dify_plugin` の下に、先ほどインストールしたライブラリ名を一行追加します:
|
||||
|
||||
```plaintext
|
||||
dify_plugin
|
||||
@@ -201,7 +185,7 @@ print(ph_link)
|
||||
この例では `telegraph_access_token` が必要です。プロバイダー設定でこの認証情報を定義し、ユーザーがプラグインを使用する際に入力できるようにする必要があります。プロバイダー設定の詳細については、[一般仕様定義](/plugin-dev-ja/0411-general-specifications) を参照してください。
|
||||
|
||||
1. **プロバイダー YAML の編集:** `telegraph/provider/telegraph.yaml` ファイルを開きます。
|
||||
2. **`credentials_for_provider` の追加:** ファイルの末尾(または適切な場所)に以下の内容を追加します:
|
||||
2. **`credentials_for_provider の追加:`** ファイルの末尾(または適切な場所)に以下の内容を追加します:
|
||||
|
||||
```yaml
|
||||
# ... (ファイルに既にある identity, name, label, description, icon などは変更しません) ...
|
||||
@@ -224,7 +208,6 @@ print(ph_link)
|
||||
# ... (その他の言語)
|
||||
url: https://telegra.ph/api#createAccount # ヘルプヒントをクリックしたときにジャンプする URL
|
||||
```
|
||||
|
||||
- **フィールドの説明:**
|
||||
- `telegraph_access_token`: 認証情報の一意の識別子。コード内では `self.runtime.credentials["telegraph_access_token"]` を介してユーザーが入力した値にアクセスします。
|
||||
- `type: secret-input`: Dify UI 上でパスワード入力フィールドとして表示されます。
|
||||
@@ -237,7 +220,7 @@ print(ph_link)
|
||||
それでは、実際に公開操作を実行するツールのコードを記述しましょう。
|
||||
|
||||
1. **ツール Python ファイルの編集:** `telegraph/tools/telegraph.py` を開きます。
|
||||
2. **`_invoke` メソッドの実装:** ファイルの内容を以下のコードに置き換えます:
|
||||
2. **`_invoke メソッドの実装:`** ファイルの内容を以下のコードに置き換えます:
|
||||
|
||||
```python
|
||||
from collections.abc import Generator
|
||||
@@ -292,7 +275,6 @@ print(ph_link)
|
||||
# create_link_message を使用してリンクを含む出力メッセージを生成
|
||||
yield self.create_link_message(ph_link)
|
||||
```
|
||||
|
||||
- **重要なポイント:**
|
||||
- `self.runtime.credentials` から認証情報を取得します。
|
||||
- `tool_parameters` からツールの入力パラメータを取得します(パラメータ名は次のステップの YAML で定義します)。`.get()` を使用する方が堅牢な方法です。
|
||||
@@ -351,15 +333,14 @@ print(ph_link)
|
||||
python:
|
||||
source: tools/telegraph.py # このツールのロジックを実装する Python ファイルを指す
|
||||
```
|
||||
|
||||
- **フィールドの説明:**
|
||||
- `identity`: ツールの基本情報、`name` は一意の識別子です。
|
||||
- `description`: `human` (ユーザー向け) と `llm` (Agent 向け) に分かれます。**`llm` の説明は、Agent がツールを正しく理解して使用できるかどうかにおいて非常に重要です。**
|
||||
- `description`: `human` (ユーザー向け) と `llm` (Agent 向け) に分かれます。**`llm の説明は、Agent がツールを正しく理解して使用できるかどうかにおいて非常に重要です。`**
|
||||
- `parameters`: 各入力パラメータを定義します。
|
||||
- `name`: 内部名、Python コードの `tool_parameters.get("...")` のキーと一致する必要があります。
|
||||
- `type`: データ型 (例: `string`, `number`, `boolean` など)。
|
||||
- `required`: 提供が必須かどうか。
|
||||
- `label`, `human_description`, `llm_description`: `identity` の説明と同様ですが、特定のパラメータに対するものです。**`llm_description` は、LLM がそのパラメータの値をどのように生成または取得するか(ここでの Markdown のようなフォーマット要件を含む)を明確に指示する必要があります。**
|
||||
- `label`, `human_description`, `llm_description`: `identity` の説明と同様ですが、特定のパラメータに対するものです。**`llm_description は、LLM がそのパラメータの値をどのように生成または取得するか(ここでの Markdown のようなフォーマット要件を含む)を明確に指示する必要があります。`**
|
||||
- `form`: パラメータが Dify でどのように表示され、入力されるかを定義します。`llm` は、そのパラメータ値をユーザーが入力したり、変数を介して渡したり、Agent モードで LLM が自律的に決定したりできることを示します。`form` は通常、ユーザーが UI 上で固定的に入力する必要がある設定項目を示します。ツール入力の場合、`llm` の方が一般的です。
|
||||
- `extra.python.source`: このツールのロジックを実装する Python ファイルのパス(プロジェクトルートディレクトリからの相対パス)を示します。
|
||||
|
||||
@@ -368,7 +349,7 @@ print(ph_link)
|
||||
ユーザーが提供した認証情報が有効であることを保証するために、検証ロジックを実装すべきです。
|
||||
|
||||
1. **プロバイダー Python ファイルの編集:** `telegraph/provider/telegraph.py` を開きます。
|
||||
2. **`_validate_credentials` メソッドの実装:** ファイルの内容を以下に置き換えます:
|
||||
2. **`_validate_credentials メソッドの実装:`** ファイルの内容を以下に置き換えます:
|
||||
|
||||
```python
|
||||
from typing import Any
|
||||
@@ -400,7 +381,6 @@ print(ph_link)
|
||||
raise ToolProviderCredentialValidationError(f"Telegraph 認証情報の検証に失敗しました: {e}")
|
||||
|
||||
```
|
||||
|
||||
- **重要なポイント:**
|
||||
- `credentials` 辞書から認証情報を取得します。
|
||||
- その認証情報が必要な API 呼び出しを実行します(アカウント情報の取得など、読み取り専用操作が望ましいです。もしなければ、無害なテストページを作成することもできますが、副作用の可能性に注意してください)。
|
||||
@@ -411,50 +391,41 @@ print(ph_link)
|
||||
|
||||
これでプラグインをローカルで実行し、Dify でデバッグできます。
|
||||
|
||||
1. **`.env` ファイルの準備:**
|
||||
|
||||
1. **`.env ファイルの準備:`**
|
||||
- `telegraph` プロジェクトディレクトリにいることを確認してください。
|
||||
- 環境変数テンプレートファイルをコピーします:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
- **`.env` ファイルの編集:** 作成したばかりの `.env` ファイルを開き、Dify 環境情報を入力します:
|
||||
- **`.env ファイルの編集:`** 作成したばかりの `.env` ファイルを開き、Dify 環境情報を入力します:
|
||||
|
||||
```dotenv
|
||||
DIFY_API_HOST=https://your-dify-host.com # ご自身の Dify インスタンスアドレスに置き換えてください (例: https://cloud.dify.ai)
|
||||
DIFY_API_KEY=your-api-key # ご自身の Dify API キーに置き換えてください
|
||||
```
|
||||
|
||||
- **ホストとキーの取得:** Dify 環境にログインし、右上の「プラグイン」アイコンをクリックし、次にデバッグアイコン(または虫のような形)をクリックします。ポップアップウィンドウで、「API キー (Key)」と「ホストアドレス (Host)」をコピーします。 _(ローカルの対応するスクリーンショットを参照してください。キーとホストアドレスの取得画面が表示されています)_
|
||||
|
||||
2. **ローカルプラグインサービスの起動:**
|
||||
|
||||
- Python 仮想環境がアクティベートされていることを確認してください。
|
||||
- `telegraph` ディレクトリで、メインプログラムを実行します:
|
||||
|
||||
```bash
|
||||
python -m main
|
||||
```
|
||||
|
||||
- **ターミナル出力の確認:** すべてが正常であれば、以下のようなログ情報が表示され、プラグインツールが正常にロードされ、Dify に接続されたことを示します:
|
||||
|
||||
```json
|
||||
{"event": "log", "data": {"level": "INFO", "message": "Installed tool: telegraph_publisher", "timestamp": 1678886400.123456}}
|
||||
{"event": "log", "data": {"level": "INFO", "message": "Plugin daemon started, waiting for requests...", "timestamp": 1678886400.123457}}
|
||||
```
|
||||
|
||||
3. **Dify での確認とテスト:**
|
||||
|
||||
- **Dify ページを更新:** Dify 環境(ブラウザ)に戻り、プラグイン管理ページ (通常は `https://your-dify-host.com/plugins`) を更新します。
|
||||
- **プラグインを検索:** リストに "Telegraph" (またはプロバイダー YAML で定義した `label`) という名前のプラグインが表示され、「デバッグ中」のマークが付いている場合があります。
|
||||
- **認証情報を追加:** そのプラグインをクリックすると、以前 `provider/telegraph.yaml` で定義した "Telegraph Access Token" の入力を求められます。有効なトークンを入力して保存します。検証ロジック (`_validate_credentials`) が正しく実装されていれば、ここで検証が行われます。 _(ローカルの対応するスクリーンショットを参照してください。プラグインがリストに表示され、認証を要求する画面が表示されています)_
|
||||
- **アプリケーションで使用:** これで、Dify のアプリケーション(Chatbot や Workflow など)にこのツールノードを追加し、呼び出すことができます!アプリケーションで実行してツールをトリガーすると、リクエストはローカルで実行されている `python -m main` プロセスに転送されて処理されます。ローカルターミナルで関連するログ出力を確認し、デバッグできます。
|
||||
|
||||
4. **ローカルサービスの停止:** ターミナルで `Ctrl + C` を押すと、ローカルプラグインサービスを停止できます。
|
||||
|
||||
この実行 -> テスト -> 停止 -> コード修正 -> 再実行のサイクルが、プラグイン開発の主なフローです。
|
||||
この実行 -\> テスト -\> 停止 -\> コード修正 -\> 再実行のサイクルが、プラグイン開発の主なフローです。
|
||||
|
||||
## 6. プラグインメタ情報の整備
|
||||
|
||||
@@ -462,9 +433,8 @@ print(ph_link)
|
||||
|
||||
1. **アイコン (Icon):**
|
||||
- `telegraph/_assets` ディレクトリに、プラグインを表すアイコンファイル(例:`icon.png`, `icon.svg`)を配置します。正方形で鮮明な画像を推奨します。
|
||||
2. **プロバイダー情報 (`provider/telegraph.yaml`):**
|
||||
|
||||
- `identity` セクションの `label` (表示名)、`description` (機能説明)、`icon` (アイコンファイル名、例:`icon.png` を記入) が入力され、多言語対応していることを確認します。この情報は主に Dify アプリケーションオーケストレーションインターフェースでプラグインを_使用する_ユーザーに表示されます。
|
||||
2. **`プロバイダー情報 (provider/telegraph.yaml):`**
|
||||
- `identity` セクションの `label` (表示名)、`description` (機能説明)、`icon` (アイコンファイル名、例:`icon.png` を記入) が入力され、多言語対応していることを確認します。この情報は主に Dify アプリケーションオーケストレーションインターフェースでプラグインを\_使用する\_ユーザーに表示されます。
|
||||
|
||||
```yaml
|
||||
identity:
|
||||
@@ -478,9 +448,7 @@ print(ph_link)
|
||||
ja: コンテンツを簡単に公開できるTelegraphプラグイン
|
||||
icon: icon.png # _assets ディレクトリ内のアイコンファイル名を参照
|
||||
```
|
||||
|
||||
3. **プラグインマニフェスト (`manifest.yaml`):**
|
||||
|
||||
3. **`プラグインマニフェスト (manifest.yaml):`**
|
||||
- プロジェクトルートディレクトリにある `telegraph/manifest.yaml` ファイルを編集します。これはプラグイン全体の「身分証明書」のようなもので、その情報は Dify の**プラグイン管理ページ**や**プラグインマーケットプレイス (Marketplace)** に表示されます。
|
||||
- 以下のフィールドを必ず更新または確認してください:
|
||||
- `label`: プラグインの**主要な表示名** (多言語対応)。
|
||||
@@ -499,9 +467,12 @@ print(ph_link)
|
||||
tags: ['media', 'content-creation'] # タグの例
|
||||
# ... (author, name など他のフィールドは変更なし)
|
||||
```
|
||||
|
||||
4. **README とプライバシーポリシー:**
|
||||
- `README.md`: プロジェクトルートディレクトリの `README.md` ファイルを編集します。これはプラグインの **Marketplace** 上の詳細な紹介ページとなり、機能詳細、使用例、設定ガイド、よくある質問など、より豊富な情報を含めるべきです。[AWS プラグインマーケットプレイスページ](https://marketplace.dify.ai/plugins/langgenius/aws_tools) のスタイルを参考にしてください。
|
||||
|
||||
<Info>
|
||||
多言語でREADMEを提供することができます。詳細については、[多言語 README](/plugin-dev-ja/0411-multilingual-readme) をご覧ください。
|
||||
</Info>
|
||||
- `PRIVACY.md`: プラグインを公式 Marketplace に公開する予定がある場合は、プラグインがデータをどのように処理するかを説明するプライバシーポリシー説明ファイル `PRIVACY.md` を提供する必要があります。
|
||||
|
||||
## 7. プラグインのパッケージ化
|
||||
@@ -513,7 +484,6 @@ print(ph_link)
|
||||
```bash
|
||||
cd ..
|
||||
```
|
||||
|
||||
2. **パッケージ化コマンドの実行:**
|
||||
|
||||
```bash
|
||||
@@ -521,7 +491,6 @@ print(ph_link)
|
||||
```
|
||||
|
||||
(`./telegraph` をプラグインプロジェクトの実際のパスに置き換えてください)
|
||||
|
||||
3. **パッケージファイルの取得:** コマンドが正常に実行されると、現在のディレクトリに `telegraph.difypkg` (または `あなたのプラグイン名.difypkg`) という名前のファイルが生成されます。
|
||||
|
||||
この `.difypkg` ファイルは完全なプラグインパッケージです。これを以下のことができます:
|
||||
|
||||
51
plugin-dev-ja/0411-multilingual-readme.mdx
Normal file
51
plugin-dev-ja/0411-multilingual-readme.mdx
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
dimensions:
|
||||
type:
|
||||
primary: reference
|
||||
detail: core
|
||||
level: beginner
|
||||
standard_title: Multilingual README
|
||||
language: ja
|
||||
title: 多言語 README
|
||||
description: この記事では、プラグインの多言語 README のファイル仕様と、Dify Marketplace での表示ルールについて説明します。
|
||||
---
|
||||
|
||||
Dify プラグインは多言語 README に対応しており、[Dify Marketplace](https://marketplace.dify.ai/?language=ja-Jp) などでユーザーの優先言語に合わせて対応する README を表示します。
|
||||
|
||||
### README ファイルの仕様
|
||||
|
||||
| **言語** | **必須** | **ファイル名** | **保存パス** | **説明** |
|
||||
| :------ | :------ | :------------------ | :-------------------------------- | :------------------------------ |
|
||||
| 英语 | はい | `README.md` | プラグインのルートディレクトリ直下 | / |
|
||||
| その他の言語 | いいえ | `README_<言語識別子>.md` | プラグインのルートディレクトリ直下の `readme` フォルダ内 | 現在、日本語、ポルトガル語、簡体字中国語をサポートしています。 |
|
||||
|
||||
ディレクトリ構造の例は以下の通りです。
|
||||
|
||||
```bash
|
||||
...
|
||||
├── main.py
|
||||
├── manifest.yaml
|
||||
├── readme
|
||||
│ ├── README_ja_JP.md
|
||||
│ ├── README_pt_BR.md
|
||||
│ └── README_zh_Hans.md
|
||||
├── README.md
|
||||
...
|
||||
```
|
||||
|
||||
### Marketplace での表示ルール
|
||||
|
||||
プラグインがユーザーの使用言語に対応した README ファイルを提供している場合、Dify Marketplace のプラグイン詳細ページには、その言語版の README が表示されます。
|
||||
|
||||

|
||||
|
||||
{/*
|
||||
Contributing Section
|
||||
DO NOT edit this section!
|
||||
It will be automatically generated by the script.
|
||||
*/}
|
||||
|
||||
---
|
||||
|
||||
[このページを編集する](https://github.com/langgenius/dify-docs/edit/main/plugin-dev-ja/0411-multilingual-readme.mdx) | [問題を報告する](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml)
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
---
|
||||
dimensions:
|
||||
type:
|
||||
primary: implementation
|
||||
detail: basic
|
||||
level: beginner
|
||||
standard_title: Getting Started Dify Tool
|
||||
language: zh
|
||||
title: Dify 插件开发:Hello World 指南
|
||||
description: 本文档提供了从零开始Dify插件开发的详细教程,以创建Telegraph发布插件为例,涉及环境准备、项目初始化、虚拟环境配置、插件核心逻辑开发、本地运行调试、插件元信息完善以及打包发布等环节。
|
||||
dimensions: "[object Object]"
|
||||
standard_title: "Getting Started Dify Tool"
|
||||
language: "zh"
|
||||
title: "Dify 插件开发:Hello World 指南"
|
||||
description: "本文档提供了从零开始Dify插件开发的详细教程,以创建Telegraph发布插件为例,涉及环境准备、项目初始化、虚拟环境配置、插件核心逻辑开发、本地运行调试、插件元信息完善以及打包发布等环节。"
|
||||
---
|
||||
|
||||
欢迎阅读 Dify 插件开发的入门指南!本教程假设您具备基本的编程背景知识,并有使用 Dify 平台的经验。完成本教程后,您将掌握创建简单 Dify 插件的基础流程,从 Dify 用户迈向插件贡献者。
|
||||
@@ -31,24 +27,19 @@ description: 本文档提供了从零开始Dify插件开发的详细教程,以
|
||||
|
||||
1. **下载:** 访问 [Dify Plugin CLI Releases](https://github.com/langgenius/dify-plugin-daemon/releases) 页面。根据您的操作系统(Windows, macOS Intel/ARM, Linux)下载对应的最新版本二进制文件。
|
||||
2. **设置执行权限 (macOS / Linux):**
|
||||
|
||||
- **以下步骤以 macOS (Apple Silicon / M 系列芯片) 为例**,假设下载的文件名为 `dify-plugin-darwin-arm64`。在终端中,进入文件所在目录,并执行以下命令赋予其执行权限:
|
||||
|
||||
```bash
|
||||
chmod +x dify-plugin-darwin-arm64
|
||||
```
|
||||
|
||||
- 对于 Linux 用户,请下载对应的 Linux 版本文件并执行类似 `chmod +x <downloaded_filename>` 的命令。
|
||||
- 对于 Windows 用户,下载 `.exe` 文件后通常可直接运行。
|
||||
|
||||
3. **验证安装:**
|
||||
|
||||
- 在终端中,执行以下命令检查工具是否能正常运行(请将 `./dify-plugin-darwin-arm64` 替换为您下载的实际文件名或路径):
|
||||
|
||||
```bash
|
||||
./dify-plugin-darwin-arm64 version
|
||||
```
|
||||
|
||||
- 如果终端成功输出了版本号信息(例如 `v0.0.1-beta.15`),则说明安装成功。
|
||||
|
||||
> **提示 (Tips):**
|
||||
@@ -59,7 +50,7 @@ description: 本文档提供了从零开始Dify插件开发的详细教程,以
|
||||
> - 例如 (macOS/Linux): `sudo mv dify /usr/local/bin/`
|
||||
> - 配置完成后,直接在终端输入 `dify version` 应能成功输出版本号。
|
||||
|
||||
**为方便起见,本文后续将使用 `./dify` 作为 Dify 插件开发脚手架命令的示例。请根据您的实际情况替换为对应的命令。**
|
||||
**`为方便起见,本文后续将使用 ./dify 作为 Dify 插件开发脚手架命令的示例。请根据您的实际情况替换为对应的命令。`**
|
||||
|
||||
## 2. 初始化插件项目
|
||||
|
||||
@@ -70,13 +61,13 @@ description: 本文档提供了从零开始Dify插件开发的详细教程,以
|
||||
```bash
|
||||
./dify plugin init
|
||||
```
|
||||
|
||||
2. 根据提示依次输入插件的基本信息:
|
||||
- **Plugin name:** 插件的唯一标识符。例如:`telegraph`
|
||||
- _约束: 长度 1-128 字符,只能包含小写字母、数字、连字符(-)和下划线(\_)。_
|
||||
- **Author:** 插件作者的标识符。例如:`your-name`
|
||||
- _约束: 长度 1-64 字符,只能包含小写字母、数字、连字符(-)和下划线(\_)。_
|
||||
- **Description:** 对插件功能的简短描述。例如:`A Telegraph plugin that allows you to publish your content easily`
|
||||
- **Enable multilingual README:** 插件多语言 README 选项。勾选后,可在下方的 `Languages to generate` 中选择需要预置 README 文件的语种。
|
||||
3. **选择开发语言:** 当提示 `Select language` 时,请选择 `python`。
|
||||
4. **选择插件类型:** 当提示 `Select plugin type` 时,对于本教程,请选择 `tool`。
|
||||
5. **选择附加功能:** 接下来会提示是否需要包含 Provider 验证、持久存储等附加功能。对于这个简单的 Hello World 插件,我们暂时不需要这些,可以直接按 **回车键** 跳过所有选项,直到看到成功信息。
|
||||
@@ -101,33 +92,27 @@ description: 本文档提供了从零开始Dify插件开发的详细教程,以
|
||||
```bash
|
||||
cd telegraph
|
||||
```
|
||||
|
||||
2. **创建虚拟环境:** (建议命名为 `venv`)
|
||||
|
||||
```bash
|
||||
python -m venv venv
|
||||
```
|
||||
|
||||
3. **激活虚拟环境:**
|
||||
|
||||
- **macOS / Linux:**
|
||||
|
||||
```bash
|
||||
source venv/bin/activate
|
||||
```
|
||||
|
||||
- **Windows (cmd.exe):**
|
||||
|
||||
```bash
|
||||
venv\Scripts\activate.bat
|
||||
```
|
||||
|
||||
- **Windows (PowerShell):**
|
||||
|
||||
```bash
|
||||
venv\Scripts\Activate.ps1
|
||||
```
|
||||
|
||||
- 激活成功后,您的终端提示符前通常会显示 `(venv)` 字样。
|
||||
|
||||
### 3.2 安装基础依赖
|
||||
@@ -151,7 +136,7 @@ pip install -r requirements.txt
|
||||
3. **安装依赖 (若 VSCode 提示):** VSCode 可能会检测到 `requirements.txt` 文件并提示您安装其中的依赖项。如果出现提示,请确认安装。
|
||||
- _(请参考您本地对应的截图 ,它展示了确认安装依赖的界面)_
|
||||
|
||||
**请确保后续的所有 `pip install` 命令和运行 `python -m main` 的操作都在已激活的虚拟环境中执行。**
|
||||
**`请确保后续的所有 pip install 命令和运行 python -m main 的操作都在已激活的虚拟环境中执行。`**
|
||||
|
||||
## 4. 开发插件核心逻辑
|
||||
|
||||
@@ -186,8 +171,7 @@ print(ph_link)
|
||||
```bash
|
||||
pip install your-telegraph
|
||||
```
|
||||
|
||||
2. **更新 `requirements.txt`:** 打开项目根目录下的 `telegraph/requirements.txt` 文件,在 `dify_plugin` 下面添加一行,写入刚刚安装的库名:
|
||||
2. **`更新 requirements.txt:`** 打开项目根目录下的 `telegraph/requirements.txt` 文件,在 `dify_plugin` 下面添加一行,写入刚刚安装的库名:
|
||||
|
||||
```plaintext
|
||||
dify_plugin
|
||||
@@ -201,7 +185,7 @@ print(ph_link)
|
||||
我们的示例需要 `telegraph_access_token`。我们需要在 Provider 配置中定义这个凭证,以便用户在使用插件时可以输入。关于 Provider 配置的更多信息,请参考[一般规范定义](/plugin-dev-zh/0411-general-specifications)。
|
||||
|
||||
1. **编辑 Provider YAML:** 打开 `telegraph/provider/telegraph.yaml` 文件。
|
||||
2. **添加 `credentials_for_provider`:** 在文件末尾(或适当位置)添加以下内容:
|
||||
2. **`添加 credentials_for_provider:`** 在文件末尾(或适当位置)添加以下内容:
|
||||
|
||||
```yaml
|
||||
# ... (文件可能已有的 identity, name, label, description, icon 等保持不变) ...
|
||||
@@ -224,7 +208,6 @@ print(ph_link)
|
||||
# ... (其他语言)
|
||||
url: https://telegra.ph/api#createAccount # 点击帮助提示时跳转的 URL
|
||||
```
|
||||
|
||||
- **字段解释:**
|
||||
- `telegraph_access_token`: 凭证的唯一标识符,代码中通过 `self.runtime.credentials["telegraph_access_token"]` 来访问用户输入的值。
|
||||
- `type: secret-input`: 表示在 Dify 界面上会显示为密码输入框。
|
||||
@@ -237,7 +220,7 @@ print(ph_link)
|
||||
现在我们来编写实际执行发布操作的工具代码。
|
||||
|
||||
1. **编辑 Tool Python 文件:** 打开 `telegraph/tools/telegraph.py`。
|
||||
2. **实现 `_invoke` 方法:** 将文件内容替换为以下代码:
|
||||
2. **`实现 _invoke 方法:`** 将文件内容替换为以下代码:
|
||||
|
||||
```python
|
||||
from collections.abc import Generator
|
||||
@@ -292,7 +275,6 @@ print(ph_link)
|
||||
# 使用 create_link_message 生成一个包含链接的输出消息
|
||||
yield self.create_link_message(ph_link)
|
||||
```
|
||||
|
||||
- **关键点:**
|
||||
- 从 `self.runtime.credentials` 获取凭证。
|
||||
- 从 `tool_parameters` 获取工具的输入参数(参数名将在下一步的 YAML 中定义)。使用 `.get()` 是更健壮的方式。
|
||||
@@ -351,15 +333,14 @@ print(ph_link)
|
||||
python:
|
||||
source: tools/telegraph.py # 指向实现该工具逻辑的 Python 文件
|
||||
```
|
||||
|
||||
- **字段解释:**
|
||||
- `identity`: 工具的基本信息,`name` 是唯一标识。
|
||||
- `description`: 分为 `human` (给用户看) 和 `llm` (给 Agent 看)。**`llm` 描述对于 Agent 能否正确理解和使用工具至关重要。**
|
||||
- `description`: 分为 `human` (给用户看) 和 `llm` (给 Agent 看)。**`llm 描述对于 Agent 能否正确理解和使用工具至关重要。`**
|
||||
- `parameters`: 定义每个输入参数。
|
||||
- `name`: 内部名称,需与 Python 代码中 `tool_parameters.get("...")` 的键一致。
|
||||
- `type`: 数据类型 (如 `string`, `number`, `boolean` 等)。
|
||||
- `required`: 是否必须提供。
|
||||
- `label`, `human_description`, `llm_description`: 类似 `identity` 中的描述,但针对具体参数。**`llm_description` 应清晰指导 LLM 如何生成或获取该参数的值,包括格式要求(如此处的 Markdown)。**
|
||||
- `label`, `human_description`, `llm_description`: 类似 `identity` 中的描述,但针对具体参数。**`llm_description 应清晰指导 LLM 如何生成或获取该参数的值,包括格式要求(如此处的 Markdown)。`**
|
||||
- `form`: 定义参数如何在 Dify 中呈现和填充。`llm` 表示该参数值可以由用户输入、通过变量传入,或者在 Agent 模式下由 LLM 自主决定;`form` 通常表示需要用户在界面上固定填写的配置项。对于工具输入,`llm` 更常见。
|
||||
- `extra.python.source`: 指明实现此工具逻辑的 Python 文件路径(相对于项目根目录)。
|
||||
|
||||
@@ -368,7 +349,7 @@ print(ph_link)
|
||||
为了确保用户提供的凭证有效,我们应该实现验证逻辑。
|
||||
|
||||
1. **编辑 Provider Python 文件:** 打开 `telegraph/provider/telegraph.py`。
|
||||
2. **实现 `_validate_credentials` 方法:** 将文件内容替换为:
|
||||
2. **`实现 _validate_credentials 方法:`** 将文件内容替换为:
|
||||
|
||||
```python
|
||||
from typing import Any
|
||||
@@ -400,7 +381,6 @@ print(ph_link)
|
||||
raise ToolProviderCredentialValidationError(f"Telegraph 凭证验证失败: {e}")
|
||||
|
||||
```
|
||||
|
||||
- **关键点:**
|
||||
- 从 `credentials` 字典中获取凭证。
|
||||
- 执行一个需要该凭证的 API 调用(最好是只读操作,如获取账户信息;如果没有,创建一个无害的测试页面也可以,但要注意可能产生的副作用)。
|
||||
@@ -411,50 +391,41 @@ print(ph_link)
|
||||
|
||||
现在可以在本地运行插件,并在 Dify 中进行调试了。
|
||||
|
||||
1. **准备 `.env` 文件:**
|
||||
|
||||
1. **`准备 .env 文件:`**
|
||||
- 确保您仍在 `telegraph` 项目目录下。
|
||||
- 复制环境变量模板文件:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
- **编辑 `.env` 文件:** 打开刚刚创建的 `.env` 文件,填入您的 Dify 环境信息:
|
||||
- **`编辑 .env 文件:`** 打开刚刚创建的 `.env` 文件,填入您的 Dify 环境信息:
|
||||
|
||||
```dotenv
|
||||
DIFY_API_HOST=https://your-dify-host.com # 替换为您的 Dify 实例地址 (例如 https://cloud.dify.ai)
|
||||
DIFY_API_KEY=your-api-key # 替换为您的 Dify API 密钥
|
||||
```
|
||||
|
||||
- **获取 Host 和 Key:** 登录您的 Dify 环境,点击右上角的“插件”图标,然后点击调试图标(或类似虫子形状)。在弹出的窗口中,复制“API 密钥 (Key)”和“主机地址 (Host)”。 _(请参考您本地对应的截图 ,它展示了获取密钥和主机地址的界面)_
|
||||
|
||||
2. **启动本地插件服务:**
|
||||
|
||||
- 确保您的 Python 虚拟环境已激活。
|
||||
- 在 `telegraph` 目录下,运行主程序:
|
||||
|
||||
```bash
|
||||
python -m main
|
||||
```
|
||||
|
||||
- **观察终端输出:** 如果一切正常,您应该会看到类似以下的日志信息,表示插件工具已成功加载并连接到 Dify:
|
||||
|
||||
```json
|
||||
{"event": "log", "data": {"level": "INFO", "message": "Installed tool: telegraph_publisher", "timestamp": 1678886400.123456}}
|
||||
{"event": "log", "data": {"level": "INFO", "message": "Plugin daemon started, waiting for requests...", "timestamp": 1678886400.123457}}
|
||||
```
|
||||
|
||||
3. **在 Dify 中查看并测试:**
|
||||
|
||||
- **刷新 Dify 页面:** 回到您的 Dify 环境(浏览器中),刷新插件管理页面 (通常是 `https://your-dify-host.com/plugins`)。
|
||||
- **查找插件:** 您应该能在列表中看到名为 "Telegraph" (或您在 Provider YAML 中定义的 `label`) 的插件,并且可能带有一个“调试中”的标记。
|
||||
- **添加凭证:** 点击该插件,系统会提示您输入之前在 `provider/telegraph.yaml` 中定义的 "Telegraph Access Token"。输入有效的 token 并保存。如果您的验证逻辑 (`_validate_credentials`) 实现正确,这里会进行验证。 _(请参考您本地对应的截图 ,它展示了插件出现在列表并请求授权的界面)_
|
||||
- **在应用中使用:** 现在,您可以在 Dify 的应用(如 Chatbot 或 Workflow)中添加这个工具节点,并尝试调用它了!当您在应用中运行并触发该工具时,请求会被转发到您本地运行的 `python -m main` 进程进行处理。您可以在本地终端看到相关的日志输出,并进行调试。
|
||||
|
||||
4. **停止本地服务:** 在终端中按下 `Ctrl + C` 可以停止本地插件服务。
|
||||
|
||||
这个运行 -> 测试 -> 停止 -> 修改代码 -> 重新运行 的循环是插件开发的主要流程。
|
||||
这个运行 -\> 测试 -\> 停止 -\> 修改代码 -\> 重新运行 的循环是插件开发的主要流程。
|
||||
|
||||
## 6. 完善插件元信息
|
||||
|
||||
@@ -462,9 +433,8 @@ print(ph_link)
|
||||
|
||||
1. **图标 (Icon):**
|
||||
- 在 `telegraph/_assets` 目录下放置一个代表您插件的图标文件(例如 `icon.png`, `icon.svg`)。推荐使用正方形、清晰的图片。
|
||||
2. **Provider 信息 (`provider/telegraph.yaml`):**
|
||||
|
||||
- 确保 `identity` 部分的 `label` (显示名称), `description` (功能描述), 和 `icon` (填写图标文件名,如 `icon.png`) 已填写并支持多语言。这部分信息主要在 Dify 应用编排界面中展示给_使用_插件的用户。
|
||||
2. **`Provider 信息 (provider/telegraph.yaml):`**
|
||||
- 确保 `identity` 部分的 `label` (显示名称), `description` (功能描述), 和 `icon` (填写图标文件名,如 `icon.png`) 已填写并支持多语言。这部分信息主要在 Dify 应用编排界面中展示给\_使用\_插件的用户。
|
||||
|
||||
```yaml
|
||||
identity:
|
||||
@@ -478,9 +448,7 @@ print(ph_link)
|
||||
zh_Hans: 一个让您轻松发布内容的Telegraph插件
|
||||
icon: icon.png # 引用 _assets 目录下的图标文件名
|
||||
```
|
||||
|
||||
3. **插件清单 (`manifest.yaml`):**
|
||||
|
||||
3. **`插件清单 (manifest.yaml):`**
|
||||
- 编辑项目根目录下的 `telegraph/manifest.yaml` 文件。这是整个插件的“身份证”,其信息将展示在 Dify 的**插件管理页面**和**插件市场 (Marketplace)** 中。
|
||||
- 务必更新或确认以下字段:
|
||||
- `label`: 插件的**主要显示名称** (支持多语言)。
|
||||
@@ -499,9 +467,12 @@ print(ph_link)
|
||||
tags: ['media', 'content-creation'] # 示例标签
|
||||
# ... (author, name 等其他字段保持不变)
|
||||
```
|
||||
|
||||
4. **README 和隐私政策:**
|
||||
- `README.md`: 编辑项目根目录下的 `README.md` 文件。它将作为插件在 **Marketplace** 上的详细介绍页面,应包含更丰富的信息,如功能详述、使用示例、配置指南、常见问题等。可参考 [AWS 插件市场页面](https://marketplace.dify.ai/plugins/langgenius/aws_tools) 的样式。
|
||||
|
||||
<Info>
|
||||
README 支持多语言,具体规范请阅读 [多语言 README](/plugin-dev-zh/0411-multilingual-readme)。
|
||||
</Info>
|
||||
- `PRIVACY.md`: 如果您计划将插件发布到官方 Marketplace,需要提供隐私政策说明文件 `PRIVACY.md`,描述插件如何处理数据。
|
||||
|
||||
## 7. 打包插件
|
||||
@@ -513,7 +484,6 @@ print(ph_link)
|
||||
```bash
|
||||
cd ..
|
||||
```
|
||||
|
||||
2. **执行打包命令:**
|
||||
|
||||
```bash
|
||||
@@ -521,7 +491,6 @@ print(ph_link)
|
||||
```
|
||||
|
||||
(请将 `./telegraph` 替换为您插件项目的实际路径)
|
||||
|
||||
3. **获取打包文件:** 命令执行成功后,将在当前目录下生成一个名为 `telegraph.difypkg` (或 `您的插件名.difypkg`) 的文件。
|
||||
|
||||
这个 `.difypkg` 文件就是一个完整的插件包。您可以:
|
||||
|
||||
51
plugin-dev-zh/0411-multilingual-readme.mdx
Normal file
51
plugin-dev-zh/0411-multilingual-readme.mdx
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
dimensions:
|
||||
type:
|
||||
primary: reference
|
||||
detail: core
|
||||
level: beginner
|
||||
standard_title: Multilingual README
|
||||
language: zh
|
||||
title: 多语言 README
|
||||
description: 本文介绍插件多语言 README 的文件规范及其在 Dify Marketplace 中的展示规则。
|
||||
---
|
||||
|
||||
Dify 插件支持多语言 README,并将在 [Dify Marketplace](https://marketplace.dify.ai/?language=zh-Hans) 等位置根据用户的首选语言展示对应的 README。
|
||||
|
||||
### README 文件规范
|
||||
|
||||
| 语种 | 必需 | 文件名 | 存放路径 | 说明 |
|
||||
| :------- | :-- | :----------------- | :-------------------- | :---------------- |
|
||||
| **英语** | 是 | `README.md` | 插件根目录下 | / |
|
||||
| **其他语种** | 否 | `README_<语言标识>.md` | 插件根目录下的 `readme` 文件夹中 | 目前支持日语、葡萄牙语、简体中文。 |
|
||||
|
||||
目录结构示例如下:
|
||||
|
||||
```bash
|
||||
...
|
||||
├── main.py
|
||||
├── manifest.yaml
|
||||
├── readme
|
||||
│ ├── README_ja_JP.md
|
||||
│ ├── README_pt_BR.md
|
||||
│ └── README_zh_Hans.md
|
||||
├── README.md
|
||||
...
|
||||
```
|
||||
|
||||
### Marketplace 展示规则
|
||||
|
||||
当插件提供了用户所用语言的 README 文件时,Dify Marketplace 的插件详情页将展示对应语言版本的 README。
|
||||
|
||||

|
||||
|
||||
{/*
|
||||
Contributing Section
|
||||
DO NOT edit this section!
|
||||
It will be automatically generated by the script.
|
||||
*/}
|
||||
|
||||
---
|
||||
|
||||
[编辑此页面](https://github.com/langgenius/dify-docs/edit/main/plugin-dev-zh/0411-multilingual-readme.mdx) | [提交问题](https://github.com/langgenius/dify-docs/issues/new?template=docs.yml)
|
||||
|
||||
Reference in New Issue
Block a user