diff --git a/core/http/endpoints/localai/agent_jobs.go b/core/http/endpoints/localai/agent_jobs.go index 0e65a241d..c46a0208a 100644 --- a/core/http/endpoints/localai/agent_jobs.go +++ b/core/http/endpoints/localai/agent_jobs.go @@ -147,7 +147,18 @@ func ExecuteJobEndpoint(app *application.Application) echo.HandlerFunc { req.Parameters = make(map[string]string) } - jobID, err := app.AgentJobService().ExecuteJob(req.TaskID, req.Parameters, "api") + // Build multimedia struct from request + var multimedia *schema.MultimediaAttachment + if len(req.Images) > 0 || len(req.Videos) > 0 || len(req.Audios) > 0 || len(req.Files) > 0 { + multimedia = &schema.MultimediaAttachment{ + Images: req.Images, + Videos: req.Videos, + Audios: req.Audios, + Files: req.Files, + } + } + + jobID, err := app.AgentJobService().ExecuteJob(req.TaskID, req.Parameters, "api", multimedia) if err != nil { return c.JSON(http.StatusBadRequest, map[string]string{"error": err.Error()}) } @@ -281,7 +292,7 @@ func ExecuteTaskByNameEndpoint(app *application.Application) echo.HandlerFunc { return func(c echo.Context) error { name := c.Param("name") var params map[string]string - + // Try to bind parameters from request body // If body is empty or invalid, use empty params if c.Request().ContentLength > 0 { @@ -323,7 +334,7 @@ func ExecuteTaskByNameEndpoint(app *application.Application) echo.HandlerFunc { return c.JSON(http.StatusNotFound, map[string]string{"error": "Task not found: " + name}) } - jobID, err := app.AgentJobService().ExecuteJob(task.ID, params, "api") + jobID, err := app.AgentJobService().ExecuteJob(task.ID, params, "api", nil) if err != nil { return c.JSON(http.StatusBadRequest, map[string]string{"error": err.Error()}) } @@ -336,4 +347,3 @@ func ExecuteTaskByNameEndpoint(app *application.Application) echo.HandlerFunc { }) } } - diff --git a/core/http/views/agent-jobs.html b/core/http/views/agent-jobs.html index b650e1a4c..a439f6bd2 100644 --- a/core/http/views/agent-jobs.html +++ b/core/http/views/agent-jobs.html @@ -365,21 +365,40 @@ x-cloak @click.away="showExecuteTaskModal = false; selectedTaskForExecution = null; executionParameters = {}; executionParametersText = ''" class="fixed inset-0 bg-black/50 flex items-center justify-center z-50"> -
Enter parameters as key-value pairs (one per line, format: key=value).
@@ -393,8 +412,61 @@
Example: user_name=Alice
+ Configure multimedia sources (images, videos, audios, files) to fetch when cron jobs execute. + Each source can have custom headers for authentication/authorization. These will be fetched and included in the job execution. +
+URL where multimedia content will be fetched from
+Custom headers for the HTTP request (e.g., Authorization)
+curl -X POST {{ .BaseURL }}api/agent/jobs/execute \
+ -H "Content-Type: application/json" \
+ -H "Authorization: Bearer YOUR_API_KEY" \
+ -d '{
+ "task_id": "",
+ "parameters": {
+ "user_name": "Alice",
+ "task_description": "Analyze this image"
+ },
+ "images": [
+ "https://example.com/image.png",
+ "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
+ ]
+ }'
+
+ You can provide multimedia content as URLs or base64-encoded data URIs. Supported types: images, videos, audios, and files.
+
Enter parameters as key-value pairs (one per line, format: key=value).
@@ -508,8 +607,61 @@ Provide a detailed response that addresses their specific needs.
Example: user_name=Alice