dify插件代码

Yeuoly 07d13bfb59 Merge pull request #99 from langgenius/fix/remove-proxy-args-from-uv 7 ヶ月 前
.github fce99c8dc7 fix: Prevent Docker Hub login during pull requests 7 ヶ月 前
.script 81c3deb4fa feat: installation script (#14) 9 ヶ月 前
.vscode ba80dcc78d readme (#68) 8 ヶ月 前
cmd 6ce5373848 fix: bump cli sdk template to 0.0.1b72 (#86) 7 ヶ月 前
docker fb903d6b8d fix: add PATH to uv installation command (#90) 7 ヶ月 前
docs 309142acf1 bump: cli version (#24) 8 ヶ月 前
internal 14a11e8773 fix: Remove redundant proxy handling in Python environment setup 7 ヶ月 前
pkg 1944a829d2 feat: add plugin access action to session write method (#64) 8 ヶ月 前
tests b19140ca23 refactor: optimize plugin declaration caching and encoding (#34) 8 ヶ月 前
.env.example 1d3342e730 fix: enhance env.example (#65) 8 ヶ月 前
.gitignore 2f8d22fcc6 add ide config to .gitignore (#18) 9 ヶ月 前
LICENSE 41ff75a976 LICENSE (#42) 8 ヶ月 前
README.md ba80dcc78d readme (#68) 8 ヶ月 前
dify.rb 309142acf1 bump: cli version (#24) 8 ヶ月 前
entrypoint.sh 6ba6c9ace7 add entrypoint for service 10 ヶ月 前
go.mod d5d12a0589 feat: add patch mechanism for Python plugin SDK memory leak (#55) 8 ヶ月 前
go.sum d5d12a0589 feat: add patch mechanism for Python plugin SDK memory leak (#55) 8 ヶ月 前

README.md

Dify Plugin Daemon

Overview

Dify Plugin Daemon is a service that manages the lifecycle of plugins. It's responsible for 3 types of runtimes:

  1. Local runtime: runs on the same machine as the Dify server.
  2. Debug runtime: listens to a port to wait for a debugging plugin to connect.
  3. Serverless runtime: runs on a serverless platform such as AWS Lambda.

Dify api server will communicate with the daemon to get all the status of plugins like which plugin was installed to which workspace, and receive requests from Dify api server to invoke a plugin like a serverless function.

All requests from Dify api based on HTTP protocol, but depends on the runtime type, the daemon will forward the request to the corresponding runtime in different ways.

  • For local runtime, daemon will start plugin as the subprocess and communicate with the plugin via STDIN/STDOUT.
  • For debug runtime, daemon wait for a plugin to connect and communicate in full-duplex way, it's TCP based.
  • For serverless runtime, plugin will be packaged to a third-party service like AWS Lambda and then be invoked by the daemon via HTTP protocol.

For more detailed introduction about Dify plugin, please refer to our docs https://docs.dify.ai/plugins/introduction.

Development

Run daemon

Firstly copy the .env.example file to .env and set the correct environment variables like DB_HOST etc.

cp .env.example .env

Attention that the PYTHON_INTERPRETER_PATH is the path to the python interpreter, please specify the correct path according to your python installation and make sure the python version is 3.11 or higher, as dify-plugin-sdk requires.

We recommend you to use vscode to debug the daemon, and a launch.json file is provided in the .vscode directory.

LICENSE

Dify Plugin Daemon is released under the Apache-2.0 license.