mirror of
https://github.com/langgenius/dify-plugin-daemon.git
synced 2026-07-22 17:56:00 -04:00
3d28e0ceed
* feat: Add code generation for plugin controllers and services - Introduced a code generation mechanism for plugin controllers and services, allowing for automatic generation based on defined dispatchers. - Created new files for generated controllers, services, and templates to streamline the plugin invocation process. - Removed outdated functions related to tool validation and runtime parameters, consolidating functionality into generated files. - Updated dependencies in go.mod and go.sum to include necessary packages for the new code generation features. * fix
41 lines
1.3 KiB
Go
41 lines
1.3 KiB
Go
package config
|
|
|
|
import (
|
|
"github.com/langgenius/dify-plugin-daemon/pkg/entities/model_entities"
|
|
"github.com/langgenius/dify-plugin-daemon/pkg/entities/plugin_entities"
|
|
"github.com/langgenius/dify-plugin-daemon/pkg/entities/requests"
|
|
)
|
|
|
|
// PluginInvoker defines a plugin invocation controller configuration
|
|
type PluginInvoker struct {
|
|
// Name is the name of the controller function
|
|
Name string
|
|
// RequestType is the request type for this controller
|
|
RequestType any
|
|
// ResponseType is the response type for this controller
|
|
ResponseType any
|
|
// ResponseTypeName is the name of the response type
|
|
ResponseTypeName string
|
|
// BufferSize is the size of the response buffer
|
|
BufferSize int
|
|
}
|
|
|
|
// PluginInvokers is a map of plugin invoker configurations
|
|
var PluginInvokers = map[string]PluginInvoker{
|
|
"InvokeLLM": {
|
|
Name: "InvokeLLM",
|
|
RequestType: plugin_entities.InvokePluginRequest[requests.RequestInvokeLLM]{},
|
|
ResponseType: model_entities.LLMResultChunk{},
|
|
ResponseTypeName: "LLMResultChunk",
|
|
BufferSize: 512,
|
|
},
|
|
"InvokeTextEmbedding": {
|
|
Name: "InvokeTextEmbedding",
|
|
RequestType: plugin_entities.InvokePluginRequest[requests.RequestInvokeTextEmbedding]{},
|
|
ResponseType: model_entities.TextEmbeddingResult{},
|
|
ResponseTypeName: "TextEmbeddingResult",
|
|
BufferSize: 1,
|
|
},
|
|
// ... other plugin invokers
|
|
}
|