Files
Riskey 2f88f0f7d2 docs: sync Cloud documentation for Dify 1.15.0 (#835)
* 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
2026-07-02 19:51:55 +08:00

158 lines
5.0 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
dimensions:
type:
primary: conceptual
detail: architecture
level: beginner
standard_title: CLI
language: zh
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](/zh/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
```