Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions core/Controller/TaskProcessingApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,13 @@ public function taskTypesExAppEndpoint(): DataResponse {
private function handleScheduleTaskInternal(
array $input, string $type, string $appId, string $customId = '',
?string $webhookUri = null, ?string $webhookMethod = null, bool $includeWatermark = true,
bool $preferStreaming = false,
): DataResponse {
$task = new Task($type, $input, $appId, $this->userId, $customId);
$task->setWebhookUri($webhookUri);
$task->setWebhookMethod($webhookMethod);
$task->setIncludeWatermark($includeWatermark);
$task->setPreferStreaming($preferStreaming);
try {
$this->taskProcessingManager->scheduleTask($task);

Expand Down Expand Up @@ -202,6 +204,7 @@ private function handleScheduleTaskInternal(
* @param string|null $webhookUri URI to be requested when the task finishes
* @param string|null $webhookMethod Method used for the webhook request (HTTP:GET, HTTP:POST, HTTP:PUT, HTTP:DELETE or AppAPI:APP_ID:GET, AppAPI:APP_ID:POST...)
* @param bool $includeWatermark Whether to include a watermark in the output file or not
* @param bool $preferStreaming Whether to prefer getting a progressive output from the provider or not
* @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_BAD_REQUEST|Http::STATUS_PRECONDITION_FAILED|Http::STATUS_UNAUTHORIZED, array{message: string}, array{}>
*
* 200: Task scheduled successfully
Expand All @@ -215,6 +218,7 @@ private function handleScheduleTaskInternal(
public function schedule(
array $input, string $type, string $appId, string $customId = '',
?string $webhookUri = null, ?string $webhookMethod = null, bool $includeWatermark = true,
bool $preferStreaming = false,
): DataResponse {
return $this->handleScheduleTaskInternal(
$input,
Expand All @@ -224,6 +228,7 @@ public function schedule(
$webhookUri,
$webhookMethod,
$includeWatermark,
$preferStreaming,
);
}

Expand All @@ -239,6 +244,7 @@ public function schedule(
* @param string|null $webhookUri URI to be requested when the task finishes
* @param string|null $webhookMethod Method used for the webhook request (HTTP:GET, HTTP:POST, HTTP:PUT, HTTP:DELETE or AppAPI:APP_ID:GET, AppAPI:APP_ID:POST...)
* @param bool $includeWatermark Whether to include a watermark in the output file or not
* @param bool $preferStreaming Whether to prefer getting a progressive output from the provider or not
* @return DataResponse<Http::STATUS_OK, array{task: CoreTaskProcessingTask}, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_BAD_REQUEST|Http::STATUS_PRECONDITION_FAILED|Http::STATUS_UNAUTHORIZED, array{message: string}, array{}>
*
* 200: Task scheduled successfully
Expand All @@ -251,6 +257,7 @@ public function schedule(
public function scheduleExAppEndpoint(
array $input, string $type, string $appId, string $customId = '',
?string $webhookUri = null, ?string $webhookMethod = null, bool $includeWatermark = true,
bool $preferStreaming = false,
): DataResponse {
return $this->handleScheduleTaskInternal(
$input,
Expand All @@ -260,6 +267,7 @@ public function scheduleExAppEndpoint(
$webhookUri,
$webhookMethod,
$includeWatermark,
$preferStreaming,
);
}

Expand Down
2 changes: 1 addition & 1 deletion core/Migrations/Version35000Date20260527162338.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
if (!$table->hasColumn('prefer_streaming')) {
$table->addColumn('prefer_streaming', Types::SMALLINT, [
'notnull' => true,
'default' => 1,
'default' => 0,
'unsigned' => true,
]);
return $schema;
Expand Down
5 changes: 5 additions & 0 deletions core/openapi-ex_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions core/openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -5098,6 +5098,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}
Expand Down Expand Up @@ -10457,6 +10462,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions core/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -5098,6 +5098,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/public/TaskProcessing/SynchronousProviderOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SynchronousProviderOptions {
*/
public function __construct(
private readonly bool $includeWatermarks = false,
private readonly bool $preferStreaming = true,
private readonly bool $preferStreaming = false,
?callable $reportIntermediateOutput = null,
) {
$this->reportIntermediateOutput = $reportIntermediateOutput !== null
Expand Down
2 changes: 1 addition & 1 deletion lib/public/TaskProcessing/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class Task implements \JsonSerializable {

protected bool $includeWatermark = true;

protected bool $preferStreaming = true;
protected bool $preferStreaming = false;

/**
* @since 30.0.0
Expand Down
10 changes: 10 additions & 0 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -8803,6 +8803,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}
Expand Down Expand Up @@ -14165,6 +14170,11 @@
"type": "boolean",
"default": true,
"description": "Whether to include a watermark in the output file or not"
},
"preferStreaming": {
"type": "boolean",
"default": false,
"description": "Whether to prefer getting a progressive output from the provider or not"
}
}
}
Expand Down
Loading