Files
Yeuoly b286be778e chore: remove JSON schema validation from tool and agent services (#430)
* chore: remove JSON schema validation from tool and agent services

- Remove bindAgentStrategyValidator and bindToolValidator functions
- Remove gojsonschema dependency
- Simplify InvokeAgentStrategy by removing validation logic
- Consolidate tool invocation into generated code
- Remove redundant tool_service.go and related test files
- Move InvokeTool to generated files for consistency

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: remove duplicated routes

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-26 20:36:25 +08:00

66 lines
2.0 KiB
Go

// Code generated by controller generator. DO NOT EDIT.
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,
)
}
func ValidateToolCredentials(
r *plugin_entities.InvokePluginRequest[requests.RequestValidateToolCredentials],
ctx *gin.Context,
max_timeout_seconds int,
) {
baseSSEWithSession(
func(session *session_manager.Session) (*stream.Stream[tool_entities.ValidateCredentialsResult], error) {
return plugin_daemon.ValidateToolCredentials(session, &r.Data)
},
access_types.PLUGIN_ACCESS_TYPE_TOOL,
access_types.PLUGIN_ACCESS_ACTION_VALIDATE_TOOL_CREDENTIALS,
r,
ctx,
max_timeout_seconds,
)
}
func GetToolRuntimeParameters(
r *plugin_entities.InvokePluginRequest[requests.RequestGetToolRuntimeParameters],
ctx *gin.Context,
max_timeout_seconds int,
) {
baseSSEWithSession(
func(session *session_manager.Session) (*stream.Stream[tool_entities.GetToolRuntimeParametersResponse], error) {
return plugin_daemon.GetToolRuntimeParameters(session, &r.Data)
},
access_types.PLUGIN_ACCESS_TYPE_TOOL,
access_types.PLUGIN_ACCESS_ACTION_GET_TOOL_RUNTIME_PARAMETERS,
r,
ctx,
max_timeout_seconds,
)
}