mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-26 13:18:34 +07:00
fix: correct code langs (#708)
This commit is contained in:
@@ -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"
|
||||
@@ -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."""
|
||||
|
||||
@@ -143,7 +143,7 @@ Issue イベントを例にとると、`events/issues/issues.yaml` と `events/i
|
||||
|
||||
<Tabs>
|
||||
<Tab title="issues.yaml">
|
||||
```YAML
|
||||
```yaml
|
||||
identity:
|
||||
name: issues
|
||||
author: langgenius
|
||||
@@ -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
|
||||
|
||||
@@ -207,7 +207,7 @@ Issue イベントを例にとると、`events/issues/issues.yaml` と `events/i
|
||||
|
||||
<Tabs>
|
||||
<Tab title="issues.yaml">
|
||||
```YAML
|
||||
```yaml
|
||||
parameters:
|
||||
- name: added_label
|
||||
label:
|
||||
@@ -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:
|
||||
@@ -258,7 +258,7 @@ OAuth または API キーによる自動サブスクリプション作成を有
|
||||
<Tab title="github.yaml">
|
||||
`github.yaml` に以下のフィールドを追加します。
|
||||
|
||||
```YAML
|
||||
```yaml
|
||||
subscription_constructor:
|
||||
parameters:
|
||||
- name: "repository"
|
||||
@@ -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:
|
||||
@@ -396,7 +396,7 @@ OAuth による自動サブスクリプション作成も同じ `Constructor`
|
||||
|
||||
### Trigger
|
||||
|
||||
```Python
|
||||
```python
|
||||
class Trigger(ABC):
|
||||
@abstractmethod
|
||||
def _dispatch_event(self, subscription: Subscription, request: Request) -> EventDispatch:
|
||||
@@ -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:
|
||||
@@ -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:
|
||||
|
||||
@@ -25,7 +25,7 @@ title: ローカルソースコードからの起動
|
||||
|
||||
git コマンドを実行して [Dify リポジトリ](https://github.com/langgenius/dify) をクローンします。
|
||||
|
||||
```Bash
|
||||
```bash
|
||||
git clone https://github.com/langgenius/dify.git
|
||||
```
|
||||
|
||||
@@ -33,7 +33,7 @@ git clone https://github.com/langgenius/dify.git
|
||||
|
||||
ストレージ用(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
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -21,7 +21,7 @@ icon: "note-sticky"
|
||||
|
||||
二重波括弧を使用してワークフロー変数を参照します:`{{ variable_name }}`。ドット記法とブラケット構文を使用して、ネストされたオブジェクトプロパティや配列要素にアクセスできます。
|
||||
|
||||
```jinja2
|
||||
```jinja
|
||||
{{ user.name }}
|
||||
{{ items[0].title }}
|
||||
{{ data.metrics.score }}
|
||||
@@ -31,7 +31,7 @@ icon: "note-sticky"
|
||||
|
||||
if-else文を使用してデータ値に基づいて異なるコンテンツを表示します:
|
||||
|
||||
```jinja2
|
||||
```jinja
|
||||
{% if user.subscription == 'premium' %}
|
||||
おかえりなさい、プレミアムメンバー様!すべての機能にアクセスできます。
|
||||
{% else %}
|
||||
@@ -43,7 +43,7 @@ if-else文を使用してデータ値に基づいて異なるコンテンツを
|
||||
|
||||
for ループを使用して配列とオブジェクトを処理し、反復的なコンテンツを生成します:
|
||||
|
||||
```jinja2
|
||||
```jinja
|
||||
{% for item in search_results %}
|
||||
### 結果 {{ loop.index }}
|
||||
**スコア**: {{ item.score | round(2) }}
|
||||
@@ -62,7 +62,7 @@ for ループを使用して配列とオブジェクトを処理し、反復的
|
||||
|
||||
Jinja2フィルターはテンプレートレンダリング中にデータを変換します:
|
||||
|
||||
```jinja2
|
||||
```jinja
|
||||
{{ name | upper }}
|
||||
{{ price | round(2) }}
|
||||
{{ content | replace('\n', '<br>') }}
|
||||
@@ -74,7 +74,7 @@ Jinja2フィルターはテンプレートレンダリング中にデータを
|
||||
|
||||
デフォルト値と条件チェックを使用して、欠損または無効なデータを適切に処理します:
|
||||
|
||||
```jinja2
|
||||
```jinja
|
||||
{{ user.email | default('メールアドレスが提供されていません') }}
|
||||
{{ metrics.accuracy | round(2) if metrics.accuracy else '計算されていません' }}
|
||||
```
|
||||
|
||||
@@ -122,7 +122,7 @@ Webhook トリガーが受信 HTTP リクエストを処理する方法を定義
|
||||
|
||||
- 例:次のリクエストボディから、`customerName`(`Alex`)、アイテムのリスト、または `isPriority` ステータス(`true`)を抽出できます。
|
||||
|
||||
```JSON
|
||||
```json
|
||||
"customerName": "Alex",
|
||||
"items":
|
||||
[
|
||||
|
||||
@@ -231,7 +231,7 @@ Dify クラウド版では内部ネットワークの API サービスにアク
|
||||

|
||||
|
||||
2. ダウンロード完了後、ダウンロードディレクトリに移動し、以下の説明に従って圧縮ファイルを解凍し、説明の初期化スクリプトを実行します。
|
||||
```Shell
|
||||
```shell
|
||||
unzip /path/to/ngrok.zip
|
||||
./ngrok config add-authtoken あなたのToken
|
||||
```
|
||||
@@ -241,7 +241,7 @@ Dify クラウド版では内部ネットワークの API サービスにアク
|
||||
|
||||
そして、以下のコマンドを実行して起動します:
|
||||
|
||||
```Shell
|
||||
```shell
|
||||
./ngrok http ポート番号
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user