|
@@ -16,61 +16,61 @@ func (app *App) server(config *app.Config) {
|
|
|
engine.POST(
|
|
|
"/plugin/tool/invoke",
|
|
|
CheckingKey(config.PluginInnerApiKey),
|
|
|
- app.Redirect(),
|
|
|
+ app.RedirectPluginInvoke(),
|
|
|
controllers.InvokeTool,
|
|
|
)
|
|
|
engine.POST(
|
|
|
"/plugin/tool/validate_credentials",
|
|
|
CheckingKey(config.PluginInnerApiKey),
|
|
|
- app.Redirect(),
|
|
|
+ app.RedirectPluginInvoke(),
|
|
|
controllers.ValidateToolCredentials,
|
|
|
)
|
|
|
engine.POST(
|
|
|
"/plugin/llm/invoke",
|
|
|
CheckingKey(config.PluginInnerApiKey),
|
|
|
- app.Redirect(),
|
|
|
+ app.RedirectPluginInvoke(),
|
|
|
controllers.InvokeLLM,
|
|
|
)
|
|
|
engine.POST(
|
|
|
"/plugin/text_embedding/invoke",
|
|
|
CheckingKey(config.PluginInnerApiKey),
|
|
|
- app.Redirect(),
|
|
|
+ app.RedirectPluginInvoke(),
|
|
|
controllers.InvokeTextEmbedding,
|
|
|
)
|
|
|
engine.POST(
|
|
|
"/plugin/rerank/invoke",
|
|
|
CheckingKey(config.PluginInnerApiKey),
|
|
|
- app.Redirect(),
|
|
|
+ app.RedirectPluginInvoke(),
|
|
|
controllers.InvokeRerank,
|
|
|
)
|
|
|
engine.POST(
|
|
|
"/plugin/tts/invoke",
|
|
|
CheckingKey(config.PluginInnerApiKey),
|
|
|
- app.Redirect(),
|
|
|
+ app.RedirectPluginInvoke(),
|
|
|
controllers.InvokeTTS,
|
|
|
)
|
|
|
engine.POST(
|
|
|
"/plugin/speech2text/invoke",
|
|
|
CheckingKey(config.PluginInnerApiKey),
|
|
|
- app.Redirect(),
|
|
|
+ app.RedirectPluginInvoke(),
|
|
|
controllers.InvokeSpeech2Text,
|
|
|
)
|
|
|
engine.POST(
|
|
|
"/plugin/moderation/invoke",
|
|
|
CheckingKey(config.PluginInnerApiKey),
|
|
|
- app.Redirect(),
|
|
|
+ app.RedirectPluginInvoke(),
|
|
|
controllers.InvokeModeration,
|
|
|
)
|
|
|
engine.POST(
|
|
|
"/plugin/model/validate_provider_credentials",
|
|
|
CheckingKey(config.PluginInnerApiKey),
|
|
|
- app.Redirect(),
|
|
|
+ app.RedirectPluginInvoke(),
|
|
|
controllers.ValidateProviderCredentials,
|
|
|
)
|
|
|
engine.POST(
|
|
|
"/plugin/model/validate_model_credentials",
|
|
|
CheckingKey(config.PluginInnerApiKey),
|
|
|
- app.Redirect(),
|
|
|
+ app.RedirectPluginInvoke(),
|
|
|
controllers.ValidateModelCredentials,
|
|
|
)
|
|
|
|
|
@@ -78,10 +78,19 @@ func (app *App) server(config *app.Config) {
|
|
|
engine.POST(
|
|
|
"/plugin/debugging/key",
|
|
|
CheckingKey(config.PluginInnerApiKey),
|
|
|
- app.Redirect(),
|
|
|
+ app.RedirectPluginInvoke(),
|
|
|
controllers.GetRemoteDebuggingKey,
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ if config.PluginWebhookEnabled {
|
|
|
+ engine.HEAD("/webhook/:hook_id/*path", controllers.WebhookHead)
|
|
|
+ engine.POST("/webhook/:hook_id/*path", controllers.WebhookPost)
|
|
|
+ engine.GET("/webhook/:hook_id/*path", controllers.WebhookGet)
|
|
|
+ engine.PUT("/webhook/:hook_id/*path", controllers.WebhookPut)
|
|
|
+ engine.DELETE("/webhook/:hook_id/*path", controllers.WebhookDelete)
|
|
|
+ engine.OPTIONS("/webhook/:hook_id/*path", controllers.WebhookOptions)
|
|
|
+ }
|
|
|
+
|
|
|
engine.Run(fmt.Sprintf(":%d", config.ServerPort))
|
|
|
}
|