plugin

package
v0.0.0-...-6473831 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Colors
	RESET = "\033[0m"
	BOLD  = "\033[1m"

	// Foreground colors
	GREEN  = "\033[32m"
	YELLOW = "\033[33m"
	BLUE   = "\033[34m"
)
View Source
const (
	SUB_MENU_KEY_PROFILE         subMenuKey = "profile"
	SUB_MENU_KEY_LANGUAGE        subMenuKey = "language"
	SUB_MENU_KEY_CATEGORY        subMenuKey = "category"
	SUB_MENU_KEY_PERMISSION      subMenuKey = "permission"
	SUB_MENU_KEY_VERSION_REQUIRE subMenuKey = "version_require"
)
View Source
const (
	SUB_MENU_EVENT_NEXT subMenuEvent = "next"
	SUB_MENU_EVENT_PREV subMenuEvent = "prev"
	SUB_MENU_EVENT_NONE subMenuEvent = "none"
)
View Source
const AGENT_MODULE_TEMPLATE = `` /* 314-byte string literal not displayed */
View Source
const ENDPOINT_MODULE_TEMPLATE = `
========== Endpoints ==========
Path: {{.Path}}
Method: {{.Method}}
`
View Source
const MODEL_MODULE_TEMPLATE = `` /* 489-byte string literal not displayed */
View Source
const PLUGIN_GUIDE = `Before starting, here's some basic knowledge about Plugin types in Dify:

` + BOLD + `- Tool` + RESET + `: ` + GREEN + `Tool Providers like Google Search, Stable Diffusion, etc. Used to perform specific tasks.` + RESET + `
` + BOLD + `- Model` + RESET + `: ` + GREEN + `Model Providers like OpenAI, Anthropic, etc. Use their models to enhance AI capabilities.` + RESET + `
` + BOLD + `- Endpoint` + RESET + `: ` + GREEN + `Similar to Service API in Dify and Ingress in Kubernetes. Extend HTTP services as endpoints with custom logic.` + RESET + `
` + BOLD + `- Agent Strategy` + RESET + `: ` + GREEN + `Implement your own agent strategies like Function Calling, ReAct, ToT, CoT, etc.` + RESET + `

Based on the ability you want to extend, Plugins are divided into five types: ` + BOLD + `Tool` + RESET + `, ` + BOLD + `Model` + RESET + `, ` + BOLD + `Extension` + RESET + `, ` + BOLD + `Agent Strategy` + RESET + `, and ` + BOLD + `Datasource` + RESET + `.

` + BOLD + `- Tool` + RESET + `: ` + YELLOW + `A tool provider that can also implement endpoints. For example, building a Discord Bot requires both ` + BLUE + `Sending` + RESET + YELLOW + ` and ` + BLUE + `Receiving Messages` + RESET + YELLOW + `, so both ` + BOLD + `Tool` + RESET + YELLOW + ` and ` + BOLD + `Endpoint` + RESET + YELLOW + ` functionality.` + RESET + `
` + BOLD + `- Model` + RESET + `: ` + YELLOW + `Strictly for model providers, no other extensions allowed.` + RESET + `
` + BOLD + `- Extension` + RESET + `: ` + YELLOW + `For simple HTTP services that extend functionality.` + RESET + `
` + BOLD + `- Agent Strategy` + RESET + `: ` + YELLOW + `Implement custom agent logic with a focused approach.` + RESET + `
` + BOLD + `- Datasource` + RESET + `: ` + YELLOW + `Provide datasource for Dify RAG Pipeline.` + RESET + `

We've provided templates to help you get started. Choose one of the options below:
`
View Source
const PLUGIN_MODULE_TEMPLATE = `` /* 1250-byte string literal not displayed */
View Source
const TOOL_MODULE_TEMPLATE = `` /* 513-byte string literal not displayed */

Variables

View Source
var ENV_EXAMPLE []byte
View Source
var PLUGIN_PUBLISH_WORKFLOW []byte
View Source
var PRIVACY []byte
View Source
var PYTHON_AGENT_PROVIDER_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_AGENT_STRATEGY_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_AGENT_STRATEGY_TEMPLATE []byte
View Source
var PYTHON_DATASOURCE_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_DATASOURCE_PROVIDER_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_DATASOURCE_PROVIDER_PY_TEMPLATE []byte
View Source
var PYTHON_DATASOURCE_TEMPLATE []byte
View Source
var PYTHON_DIFYIGNORE []byte
View Source
var PYTHON_ENDPOINT_GROUP_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_ENDPOINT_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_ENDPOINT_TEMPLATE []byte
View Source
var PYTHON_ENTRYPOINT_TEMPLATE []byte
View Source
var PYTHON_GITIGNORE []byte
View Source
var PYTHON_GUIDE []byte
View Source
var PYTHON_LLM_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_LLM_TEMPLATE []byte
View Source
var PYTHON_MODEL_PROVIDER_PY_TEMPLATE []byte
View Source
var PYTHON_MODEL_PROVIDER_TEMPLATE []byte
View Source
var PYTHON_MODERATION_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_MODERATION_TEMPLATE []byte
View Source
var PYTHON_REQUIREMENTS_TEMPLATE []byte
View Source
var PYTHON_RERANK_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_RERANK_TEMPLATE []byte
View Source
var PYTHON_SPEECH2TEXT_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_SPEECH2TEXT_TEMPLATE []byte
View Source
var PYTHON_TEXT_EMBEDDING_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_TEXT_EMBEDDING_TEMPLATE []byte
View Source
var PYTHON_TOOL_PROVIDER_PY_TEMPLATE []byte
View Source
var PYTHON_TOOL_PROVIDER_TEMPLATE []byte
View Source
var PYTHON_TOOL_PY_TEMPLATE []byte
View Source
var PYTHON_TOOL_TEMPLATE []byte
View Source
var PYTHON_TTS_MANIFEST_TEMPLATE []byte
View Source
var PYTHON_TTS_TEMPLATE []byte
View Source
var README []byte

Functions

func CalculateChecksum

func CalculateChecksum(pluginPath string)

func EditPermission

func EditPermission(pluginPath string)

func GetLanguageName

func GetLanguageName(code string) string

GetLanguageName returns the full language name for a given language code

func InitPlugin

func InitPlugin()

func InitPluginWithFlags

func InitPluginWithFlags(
	author string,
	name string,
	repo string,
	description string,
	allowRegisterEndpoint bool,
	allowInvokeTool bool,
	allowInvokeModel bool,
	allowInvokeLLM bool,
	allowInvokeTextEmbedding bool,
	allowInvokeRerank bool,
	allowInvokeTTS bool,
	allowInvokeSpeech2Text bool,
	allowInvokeModeration bool,
	allowInvokeNode bool,
	allowInvokeApp bool,
	allowUseStorage bool,
	storageSize uint64,
	categoryStr string,
	languageStr string,
	minDifyVersion string,
	quick bool,
)

func ListReadme

func ListReadme(pluginPath string)

ListReadme displays README language information in table format for a specific plugin

func ModuleAppendEndpoints

func ModuleAppendEndpoints(pluginPath string)

func ModuleAppendTools

func ModuleAppendTools(pluginPath string)

func ModuleList

func ModuleList(pluginPath string)

func PackagePlugin

func PackagePlugin(inputPath string, outputPath string, maxSizeBytes int64)

func TestPlugin

func TestPlugin(pluginPath string)

Types

type Language

type Language struct {
	Code      string
	Name      string
	Available bool
}

Language represents supported README languages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL