mirror of
https://github.com/langgenius/dify-plugin-daemon.git
synced 2026-07-22 01:35:24 -04:00
b286be778e
* 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>
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
package controllers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/langgenius/dify-plugin-daemon/internal/service"
|
|
)
|
|
|
|
func ListTools(c *gin.Context) {
|
|
BindRequest(c, func(request struct {
|
|
TenantID string `uri:"tenant_id" validate:"required"`
|
|
Page int `form:"page" validate:"required,min=1"`
|
|
PageSize int `form:"page_size" validate:"required,min=1,max=256"`
|
|
}) {
|
|
c.JSON(http.StatusOK, service.ListTools(request.TenantID, request.Page, request.PageSize))
|
|
})
|
|
}
|
|
|
|
func GetTool(c *gin.Context) {
|
|
BindRequest(c, func(request struct {
|
|
TenantID string `uri:"tenant_id" validate:"required"`
|
|
PluginID string `form:"plugin_id" validate:"required"`
|
|
Provider string `form:"provider" validate:"required"`
|
|
}) {
|
|
c.JSON(http.StatusOK, service.GetTool(request.TenantID, request.PluginID, request.Provider))
|
|
})
|
|
}
|
|
|
|
func CheckToolExistence(c *gin.Context) {
|
|
BindRequest(c, func(request struct {
|
|
TenantID string `uri:"tenant_id" validate:"required"`
|
|
ProviderIDS []service.RequestCheckToolExistence `json:"provider_ids" validate:"required,dive"`
|
|
}) {
|
|
c.JSON(http.StatusOK, service.CheckToolExistence(request.TenantID, request.ProviderIDS))
|
|
})
|
|
}
|