mirror of
https://github.com/langgenius/dify-plugin-daemon.git
synced 2026-07-25 05:25:41 -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
30 lines
1007 B
Go
30 lines
1007 B
Go
package service
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/langgenius/dify-plugin-daemon/internal/core/plugin_daemon"
|
|
"github.com/langgenius/dify-plugin-daemon/internal/core/plugin_daemon/access_types"
|
|
"github.com/langgenius/dify-plugin-daemon/internal/core/session_manager"
|
|
"github.com/langgenius/dify-plugin-daemon/internal/utils/stream"
|
|
"github.com/langgenius/dify-plugin-daemon/pkg/entities/plugin_entities"
|
|
"github.com/langgenius/dify-plugin-daemon/pkg/entities/requests"
|
|
"github.com/langgenius/dify-plugin-daemon/pkg/entities/tool_entities"
|
|
)
|
|
|
|
func InvokeTool(
|
|
r *plugin_entities.InvokePluginRequest[requests.RequestInvokeTool],
|
|
ctx *gin.Context,
|
|
max_timeout_seconds int,
|
|
) {
|
|
baseSSEWithSession(
|
|
func(session *session_manager.Session) (*stream.Stream[tool_entities.ToolResponseChunk], error) {
|
|
return plugin_daemon.InvokeTool(session, &r.Data)
|
|
},
|
|
access_types.PLUGIN_ACCESS_TYPE_TOOL,
|
|
access_types.PLUGIN_ACCESS_ACTION_INVOKE_TOOL,
|
|
r,
|
|
ctx,
|
|
max_timeout_seconds,
|
|
)
|
|
}
|