mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-07-22 04:15:24 -04:00
2f88f0f7d2
* docs: add Human Input file inputs and Service API to Cloud docs Port the Phase 2 Human Input docs (file inputs and the Service API integration flow) to the Cloud docs, mirroring the self-host pages. - human-input.mdx (en/zh/ja): add the Single File / File List field type and the file-handling notes; the upload-limit callout states Cloud's fixed limits (documents 15 MB, images 10 MB, audio 50 MB, video 100 MB, up to 10 files) instead of self-host env vars. - hitl-api-integration-flow.mdx (en/zh/ja): new; identical to self-host since the Service API is the same. - docs.json: nest the integration-flow under the Human Input group in all three navs. - zh/ja reuse the self-host translations; only the callout and the /self-host/ links changed. * docs: rewrite Cloud model providers around AI Credits * docs: rewrite Cloud subscription management for 1.15.0 * docs: update Cloud code node limits and XLSX image extraction note * docs: rewrite Cloud team members management for 1.15.0 * docs: apply the 1.15.0 Integrations redesign to Cloud docs * docs: fix workflow API reference for run-level logs and streaming * docs: sync self-host use-dify pages and fix translation debt * docs: align shared tutorials and quick start with 1.15.0 * docs: refine difyctl install examples and workspace reference * docs: rewrite hotkeys page to match current shortcuts * fix: correct broken anchor links for badged headings and tabs * fix: correct env link and Human Input resume identifier * feat: handle heading badges in link-checker slugs * fix: repoint publish-mcp cross-links to the merged MCP section * docs: rename plugin dev CLI to Dify Plugin CLI * docs: refine CLI reference readability and expand --agent * feat: stop format checkers flagging indented list-item content * fix: correct zh/ja custom-endpoint spacing and a list blank line * docs: clarify Cloud model provider install and AI Credits coverage
158 lines
6.3 KiB
Plaintext
158 lines
6.3 KiB
Plaintext
---
|
||
dimensions:
|
||
type:
|
||
primary: conceptual
|
||
detail: architecture
|
||
level: beginner
|
||
standard_title: CLI
|
||
language: ja
|
||
title: Dify プラグイン CLI
|
||
description: Dify プラグイン CLI をインストールし、新しいプラグインプロジェクトを作成して、ローカル開発のために Dify インスタンスに接続して実行します
|
||
---
|
||
|
||
> このドキュメントは AI によって自動翻訳されています。不正確な部分がある場合は、[英語版](/en/develop-plugin/getting-started/cli) を参照してください。
|
||
|
||
Dify プラグイン CLI は、プロジェクトの初期化からパッケージ化まで、プラグイン開発ワークフローを管理します。このガイドでは、CLI のインストール、プラグインプロジェクトの作成、および Dify インスタンスに接続した実行について説明します。
|
||
|
||
<Note>
|
||
これはプラグイン開発用の Dify プラグイン CLI(`dify` コマンド)です。コマンドラインで Dify アプリを実行・管理する Dify CLI([difyctl](/ja/cli/overview))とは異なります。
|
||
</Note>
|
||
|
||
## 前提条件
|
||
|
||
始める前に、以下を準備してください。
|
||
|
||
- Python 3.12
|
||
- Homebrew(macOS のみ。CLI のインストールに使用します)
|
||
|
||
## CLI のインストール
|
||
|
||
<Tabs>
|
||
<Tab title="Mac">
|
||
```bash
|
||
brew tap langgenius/dify
|
||
brew install dify
|
||
```
|
||
</Tab>
|
||
<Tab title="Linux">
|
||
[Dify Plugin Daemon リリースページ](https://github.com/langgenius/dify-plugin-daemon/releases) から最新のバイナリをダウンロードします。x86_64 ホストの場合は `dify-plugin-linux-amd64`、ARM ホストの場合は `dify-plugin-linux-arm64` を選択してください。
|
||
|
||
```bash
|
||
chmod +x dify-plugin-linux-amd64
|
||
sudo mv dify-plugin-linux-amd64 /usr/local/bin/dify
|
||
```
|
||
</Tab>
|
||
<Tab title="Windows">
|
||
[Dify Plugin Daemon リリースページ](https://github.com/langgenius/dify-plugin-daemon/releases) から `dify-plugin-windows-amd64.exe`(または `dify-plugin-windows-arm64.exe`)をダウンロードし、`dify.exe` にリネームして、そのフォルダを `PATH` に追加します。
|
||
</Tab>
|
||
</Tabs>
|
||
|
||
インストールを確認します。
|
||
|
||
```bash
|
||
dify version
|
||
```
|
||
|
||
## プラグインプロジェクトの作成
|
||
|
||
以下のコマンドで新しいプラグインプロジェクトを作成します。
|
||
|
||
```bash
|
||
dify plugin init
|
||
```
|
||
|
||
プロンプトが表示されたら、必須フィールドを入力します。
|
||
|
||
```bash
|
||
Edit profile of the plugin
|
||
Plugin name (press Enter to next step): hello-world
|
||
Author (press Enter to next step): langgenius
|
||
Description (press Enter to next step): hello world example
|
||
Repository URL (Optional) (press Enter to next step): Repository URL (Optional)
|
||
Enable multilingual README: [✔] English is required by default
|
||
|
||
Languages to generate:
|
||
English: [✔] (required)
|
||
→ 简体中文 (Simplified Chinese): [✔]
|
||
日本語 (Japanese): [✘]
|
||
Português (Portuguese - Brazil): [✘]
|
||
|
||
Controls:
|
||
↑/↓ Navigate • Space/Tab Toggle selection • Enter Next step
|
||
```
|
||
|
||
`python` を選択して Enter キーを押すと Python プラグインテンプレートが使用されます。続いて、構築するプラグインの種類を選択します。
|
||
|
||
```bash
|
||
Select the type of plugin you want to create, and press `Enter` to continue
|
||
Before starting, here's some basic knowledge about Plugin types in Dify:
|
||
|
||
- Tool: Tool Providers like Google Search, Stable Diffusion, etc. Used to perform specific tasks.
|
||
- Model: Model Providers like OpenAI, Anthropic, etc. Use their models to enhance AI capabilities.
|
||
- Endpoint: Similar to Service API in Dify and Ingress in Kubernetes. Extend HTTP services as endpoints with custom logic.
|
||
- Trigger: Webhook-based providers that turn third-party platform events into workflow start signals.
|
||
- Agent Strategy: Implement your own agent strategies like Function Calling, ReAct, ToT, CoT, etc.
|
||
|
||
Based on the ability you want to extend, Plugins are divided into six types: Tool, Model, Extension, Agent Strategy, Datasource, and Trigger.
|
||
|
||
- Tool: A tool provider that can also implement endpoints. For example, building a Discord Bot requires both sending and receiving messages.
|
||
- Model: Strictly for model providers, no other extensions allowed.
|
||
- Extension: For simple HTTP services that extend functionality.
|
||
- Agent Strategy: Implement custom agent logic with a focused approach.
|
||
- Datasource: Provide datasource for Dify Knowledge Pipeline.
|
||
- Trigger: Build webhook integrations that emit events to kick off workflows.
|
||
|
||
We've provided templates to help you get started. Choose one of the options below:
|
||
-> tool
|
||
agent-strategy
|
||
llm
|
||
text-embedding
|
||
rerank
|
||
tts
|
||
speech2text
|
||
moderation
|
||
extension
|
||
datasource
|
||
trigger
|
||
```
|
||
|
||
最低 Dify バージョンの入力を求められたら、空白のままにすると最新バージョンが使用されます。
|
||
|
||
```bash
|
||
Edit minimal Dify version requirement, leave it blank by default
|
||
Minimal Dify version (press Enter to next step):
|
||
```
|
||
|
||
CLI はプラグイン名を付けた新しいディレクトリを作成し、基本的なプロジェクト構造をセットアップします。そのディレクトリに移動します。
|
||
|
||
```bash
|
||
cd hello-world
|
||
```
|
||
|
||
## プラグインの実行
|
||
|
||
`hello-world` ディレクトリで、サンプル環境ファイルをコピーします。
|
||
|
||
```bash
|
||
cp .env.example .env
|
||
```
|
||
|
||
`.env` ファイルを編集して、API キーやその他の設定など、プラグインの環境変数を設定します。デバッグ用の認証情報を取得するには、Dify 環境にログインし、右上の **プラグイン** をクリックしてから、デバッグアイコンをクリックします。ポップアップウィンドウで **API Key** と **Host Address** をコピーします。
|
||
|
||
```bash
|
||
INSTALL_METHOD=remote
|
||
REMOTE_INSTALL_URL=debug-plugin.dify.dev:5003
|
||
REMOTE_INSTALL_KEY=********-****-****-****-************
|
||
```
|
||
|
||
<Note>
|
||
`REMOTE_INSTALL_URL` は `host:port` 形式でホストとポートを結合します。ホストとポートは、プラグインページの **API Key** カードにまとめて表示されます。
|
||
</Note>
|
||
|
||
依存関係をインストールして、プラグインを実行します。
|
||
|
||
```bash
|
||
pip install -r requirements.txt
|
||
python -m main
|
||
```
|