Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions en/develop-plugin/dev-guides-and-walkthroughs/trigger-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ To implement subscription creation via manual URL pasting, you need to modify tw
<Tab title="github.yaml">
Since GitHub webhooks use an encryption mechanism, a secret key is required to decrypt and validate incoming requests. Therefore, you need to declare `webhook_secret` in `github.yaml`.

```YAML
```yaml
subscription_schema:
- name: "webhook_secret"
type: "secret-input"
Expand Down Expand Up @@ -112,7 +112,7 @@ To implement subscription creation via manual URL pasting, you need to modify tw
For the complete code sample, see [Dify's GitHub trigger plugin](https://github.com/langgenius/dify-plugin-sdks/tree/feat/trigger/python/examples/github_trigger).
</Tip>

```Python
```python
class GithubTrigger(Trigger):
"""Handle GitHub webhook event dispatch."""

Expand Down Expand Up @@ -141,7 +141,7 @@ Taking the Issue event as an example, you can define the event and its implement

<Tabs>
<Tab title="issues.yaml">
```YAML
```yaml
identity:
name: issues
author: langgenius
Expand All @@ -167,7 +167,7 @@ Taking the Issue event as an example, you can define the event and its implement
```
</Tab>
<Tab title="issues.py">
```Python
```python
from collections.abc import Mapping
from typing import Any

Expand Down Expand Up @@ -205,7 +205,7 @@ To filter out certain events—for example, to focus only on Issue events with a

<Tabs>
<Tab title="issues.yaml">
```YAML
```yaml
parameters:
- name: added_label
label:
Expand All @@ -221,7 +221,7 @@ To filter out certain events—for example, to focus only on Issue events with a
```
</Tab>
<Tab title="issues.py">
```Python
```python
def _check_added_label(self, payload: Mapping[str, Any], added_label_param: str | None) -> None:
"""Check if the added label matches the allowed labels"""
if not added_label_param:
Expand Down Expand Up @@ -256,7 +256,7 @@ To enable automatic subscription creation via OAuth or API key, you need to modi
<Tab title="github.yaml">
In `github.yaml`, add the following fields.

```YAML
```yaml
subscription_constructor:
parameters:
- name: "repository"
Expand Down Expand Up @@ -307,7 +307,7 @@ To enable automatic subscription creation via OAuth or API key, you need to modi
<Tab title="github.py">
In `github.py`, create a `Constructor` class to implement the automatic subscription logic.

```Python
```python
class GithubSubscriptionConstructor(TriggerSubscriptionConstructor):
"""Manage GitHub trigger subscriptions."""
def _validate_api_key(self, credentials: Mapping[str, Any]) -> None:
Expand Down Expand Up @@ -394,7 +394,7 @@ The interface definitions and implementation methods of core classes in trigger

### Trigger

```Python
```python
class Trigger(ABC):
@abstractmethod
def _dispatch_event(self, subscription: Subscription, request: Request) -> EventDispatch:
Expand Down Expand Up @@ -431,7 +431,7 @@ class Trigger(ABC):

### TriggerSubscriptionConstructor

```Python
```python
class TriggerSubscriptionConstructor(ABC, OAuthProviderProtocol):
# OPTIONAL
def _validate_api_key(self, credentials: Mapping[str, Any]) -> None:
Expand Down Expand Up @@ -594,7 +594,7 @@ class TriggerSubscriptionConstructor(ABC, OAuthProviderProtocol):

### Event

```Python
```python
class Event(ABC):
@abstractmethod
def _on_event(self, request: Request, parameters: Mapping[str, Any], payload: Mapping[str, Any]) -> Variables:
Expand Down
4 changes: 2 additions & 2 deletions en/self-host/advanced-deployments/local-source-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ title: Local Source Code Start

### Clone Dify Repository
Run the git command to clone the [Dify repository](https://github.com/langgenius/dify).
```Bash
```bash
git clone https://github.com/langgenius/dify.git
```

### Start Middlewares with Docker Compose

A series of middlewares for storage (e.g. PostgreSQL / Redis / Weaviate (if not locally available)) and extended capabilities (e.g. Dify's [sandbox](https://github.com/langgenius/dify-sandbox) and [plugin-daemon](https://github.com/langgenius/dify-plugin-daemon) services) are required by Dify backend services. Start the middlewares with Docker Compose by running these commands:

```Bash
```bash
cd docker

cp middleware.env.example middleware.env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ When developing the backend separately, you may only need to start the backend s

#### Pull the Docker image for the frontend service from DockerHub:

```Bash
```bash
docker run -it -p 3000:3000 -e CONSOLE_URL=http://127.0.0.1:5001 -e APP_URL=http://127.0.0.1:5001 langgenius/dify-web:latest
```

Expand Down
2 changes: 1 addition & 1 deletion en/use-dify/nodes/iteration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Iteration nodes output arrays that often need conversion for final use:
</Tab>

<Tab title="Using Template Node">
```jinja2
```jinja
{{ articleSections | join("\n") }}
```

Expand Down
2 changes: 1 addition & 1 deletion en/use-dify/nodes/llm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ The default variable selector for vision is `userinput.files` which automaticall

LLM prompts support Jinja2 templating for advanced variable handling. When you use Jinja2 mode (`edition_type: "jinja2"`), you can:

```jinja2
```jinja
{% for item in search_results %}
{{ loop.index }}. {{ item.title }}: {{ item.content }}
{% endfor %}
Expand Down
10 changes: 5 additions & 5 deletions en/use-dify/nodes/template.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Template nodes use Jinja2 templating syntax to create dynamic content that adapt

Reference workflow variables using double curly braces: `{{ variable_name }}`. You can access nested object properties and array elements using dot notation and bracket syntax.

```jinja2
```jinja
{{ user.name }}
{{ items[0].title }}
{{ data.metrics.score }}
Expand All @@ -28,7 +28,7 @@ Reference workflow variables using double curly braces: `{{ variable_name }}`. Y

Show different content based on data values using if-else statements:

```jinja2
```jinja
{% if user.subscription == 'premium' %}
Welcome back, Premium Member! You have access to all features.
{% else %}
Expand All @@ -40,7 +40,7 @@ Consider upgrading to Premium for additional capabilities.

Process arrays and objects with for loops to generate repetitive content:

```jinja2
```jinja
{% for item in search_results %}
### Result {{ loop.index }}
**Score**: {{ item.score | round(2) }}
Expand All @@ -59,7 +59,7 @@ Process arrays and objects with for loops to generate repetitive content:

Jinja2 filters transform data during template rendering:

```jinja2
```jinja
{{ name | upper }}
{{ price | round(2) }}
{{ content | replace('\n', '<br>') }}
Expand All @@ -71,7 +71,7 @@ Jinja2 filters transform data during template rendering:

Handle missing or invalid data gracefully using default values and conditional checks:

```jinja2
```jinja
{{ user.email | default('No email provided') }}
{{ metrics.accuracy | round(2) if metrics.accuracy else 'Not calculated' }}
```
Expand Down
2 changes: 1 addition & 1 deletion en/use-dify/nodes/trigger/webhook-trigger.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Alternatively, you can send a test request to the webhook trigger and check the

- Example: From the following request body, you can extract the `customerName` (`Alex`), the list of items, or the `isPriority` status (`true`).

```JSON
```json
"customerName": "Alex",
"items":
[
Expand Down
4 changes: 2 additions & 2 deletions en/use-dify/workspace/api-extension/api-extension.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Since the Dify cloud version cannot access internal network API services, you ca
![Download](https://assets-docs.dify.ai/dify-enterprise-mintlify/zh_CN/guides/extension/api-based-extension/c44d6cc5425508daac8d31bc4af113df.png)

2. After downloading, go to the download directory, extract the archive according to the instructions below, and execute the initialization script in the instructions.
```Shell
```shell
unzip /path/to/ngrok.zip
./ngrok config add-authtoken your-token
```
Expand All @@ -240,7 +240,7 @@ Since the Dify cloud version cannot access internal network API services, you ca

And run the following command to start:

```Shell
```shell
./ngrok http port-number
```

Expand Down
22 changes: 11 additions & 11 deletions ja/develop-plugin/dev-guides-and-walkthroughs/trigger-plugin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Notion のようなプラットフォームでは、サブスクリプション
<Tab title="github.yaml">
GitHub の webhook は暗号化メカニズムを使用しているため、受信リクエストを復号化して検証するためにシークレットキーが必要です。そのため、`github.yaml` で `webhook_secret` を宣言する必要があります。

```YAML
```yaml
subscription_schema:
- name: "webhook_secret"
type: "secret-input"
Expand Down Expand Up @@ -114,7 +114,7 @@ Notion のようなプラットフォームでは、サブスクリプション
完全なコードサンプルについては、[Dify の GitHub トリガープラグイン](https://github.com/langgenius/dify-plugin-sdks/tree/feat/trigger/python/examples/github_trigger)を参照してください。
</Tip>

```Python
```python
class GithubTrigger(Trigger):
"""Handle GitHub webhook event dispatch."""

Expand Down Expand Up @@ -143,7 +143,7 @@ Issue イベントを例にとると、`events/issues/issues.yaml` と `events/i

<Tabs>
<Tab title="issues.yaml">
```YAML
```yaml
identity:
name: issues
author: langgenius
Expand All @@ -169,7 +169,7 @@ Issue イベントを例にとると、`events/issues/issues.yaml` と `events/i
```
</Tab>
<Tab title="issues.py">
```Python
```python
from collections.abc import Mapping
from typing import Any

Expand Down Expand Up @@ -207,7 +207,7 @@ Issue イベントを例にとると、`events/issues/issues.yaml` と `events/i

<Tabs>
<Tab title="issues.yaml">
```YAML
```yaml
parameters:
- name: added_label
label:
Expand All @@ -223,7 +223,7 @@ Issue イベントを例にとると、`events/issues/issues.yaml` と `events/i
```
</Tab>
<Tab title="issues.py">
```Python
```python
def _check_added_label(self, payload: Mapping[str, Any], added_label_param: str | None) -> None:
"""Check if the added label matches the allowed labels"""
if not added_label_param:
Expand Down Expand Up @@ -258,7 +258,7 @@ OAuth または API キーによる自動サブスクリプション作成を有
<Tab title="github.yaml">
`github.yaml` に以下のフィールドを追加します。

```YAML
```yaml
subscription_constructor:
parameters:
- name: "repository"
Expand Down Expand Up @@ -309,7 +309,7 @@ OAuth または API キーによる自動サブスクリプション作成を有
<Tab title="github.py">
`github.py` で、自動サブスクリプションロジックを実装する `Constructor` クラスを作成します。

```Python
```python
class GithubSubscriptionConstructor(TriggerSubscriptionConstructor):
"""Manage GitHub trigger subscriptions."""
def _validate_api_key(self, credentials: Mapping[str, Any]) -> None:
Expand Down Expand Up @@ -396,7 +396,7 @@ OAuth による自動サブスクリプション作成も同じ `Constructor`

### Trigger

```Python
```python
class Trigger(ABC):
@abstractmethod
def _dispatch_event(self, subscription: Subscription, request: Request) -> EventDispatch:
Expand Down Expand Up @@ -433,7 +433,7 @@ class Trigger(ABC):

### TriggerSubscriptionConstructor

```Python
```python
class TriggerSubscriptionConstructor(ABC, OAuthProviderProtocol):
# OPTIONAL
def _validate_api_key(self, credentials: Mapping[str, Any]) -> None:
Expand Down Expand Up @@ -596,7 +596,7 @@ class TriggerSubscriptionConstructor(ABC, OAuthProviderProtocol):

### Event

```Python
```python
class Event(ABC):
@abstractmethod
def _on_event(self, request: Request, parameters: Mapping[str, Any], payload: Mapping[str, Any]) -> Variables:
Expand Down
4 changes: 2 additions & 2 deletions ja/self-host/advanced-deployments/local-source-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ title: ローカルソースコードからの起動

git コマンドを実行して [Dify リポジトリ](https://github.com/langgenius/dify) をクローンします。

```Bash
```bash
git clone https://github.com/langgenius/dify.git
```

### Docker Compose でミドルウェアを起動する

ストレージ用(PostgreSQL / Redis / Weaviate(ローカルで利用できない場合))や拡張機能用(Dify の [sandbox](https://github.com/langgenius/dify-sandbox) や [plugin-daemon](https://github.com/langgenius/dify-plugin-daemon) サービスなど)の一連のミドルウェアが Dify バックエンドサービスで必要です。次のコマンドを実行して Docker Compose でミドルウェアを起動します:

```Bash
```bash
cd docker

cp middleware.env.example middleware.env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title: フロントコンテナ起動

#### DockerHubからフロントエンドサービス用のDockerイメージをプルする:

```Bash
```bash
docker run -it -p 3000:3000 -e CONSOLE_URL=http://127.0.0.1:5001 -e APP_URL=http://127.0.0.1:5001 langgenius/dify-web:latest
```

Expand Down
2 changes: 1 addition & 1 deletion ja/use-dify/nodes/llm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ User: {{user_input}}

LLMプロンプトは高度な変数処理のためにJinja2テンプレートをサポートしています。Jinja2モード(`edition_type: "jinja2"`)を使用すると、次のことができます:

```jinja2
```jinja
{% for item in search_results %}
{{ loop.index }}. {{ item.title }}: {{ item.content }}
{% endfor %}
Expand Down
10 changes: 5 additions & 5 deletions ja/use-dify/nodes/template.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ icon: "note-sticky"

二重波括弧を使用してワークフロー変数を参照します:`{{ variable_name }}`。ドット記法とブラケット構文を使用して、ネストされたオブジェクトプロパティや配列要素にアクセスできます。

```jinja2
```jinja
{{ user.name }}
{{ items[0].title }}
{{ data.metrics.score }}
Expand All @@ -31,7 +31,7 @@ icon: "note-sticky"

if-else文を使用してデータ値に基づいて異なるコンテンツを表示します:

```jinja2
```jinja
{% if user.subscription == 'premium' %}
おかえりなさい、プレミアムメンバー様!すべての機能にアクセスできます。
{% else %}
Expand All @@ -43,7 +43,7 @@ if-else文を使用してデータ値に基づいて異なるコンテンツを

for ループを使用して配列とオブジェクトを処理し、反復的なコンテンツを生成します:

```jinja2
```jinja
{% for item in search_results %}
### 結果 {{ loop.index }}
**スコア**: {{ item.score | round(2) }}
Expand All @@ -62,7 +62,7 @@ for ループを使用して配列とオブジェクトを処理し、反復的

Jinja2フィルターはテンプレートレンダリング中にデータを変換します:

```jinja2
```jinja
{{ name | upper }}
{{ price | round(2) }}
{{ content | replace('\n', '<br>') }}
Expand All @@ -74,7 +74,7 @@ Jinja2フィルターはテンプレートレンダリング中にデータを

デフォルト値と条件チェックを使用して、欠損または無効なデータを適切に処理します:

```jinja2
```jinja
{{ user.email | default('メールアドレスが提供されていません') }}
{{ metrics.accuracy | round(2) if metrics.accuracy else '計算されていません' }}
```
Expand Down
Loading
Loading