modifyCurrentRequest with rest parameters

This commit is contained in:
rbertus2000 2022-10-21 23:04:42 +02:00
parent 816cf8f702
commit 1696a5c8e1

View File

@ -421,10 +421,10 @@ function onDownloadImageClick(req, img) {
imgDownload.click() imgDownload.click()
} }
function modifyCurrentRequest(req, reqDiff) { function modifyCurrentRequest(req, ...reqDiff) {
const newTaskRequest = getCurrentUserRequest() const newTaskRequest = getCurrentUserRequest()
newTaskRequest.reqBody = Object.assign({}, req, reqDiff, { newTaskRequest.reqBody = Object.assign({}, req, ...reqDiff, {
use_cpu: useCPUField.checked use_cpu: useCPUField.checked
}) })
newTaskRequest.seed = newTaskRequest.reqBody.seed newTaskRequest.seed = newTaskRequest.reqBody.seed
@ -453,13 +453,11 @@ function onMakeSimilarClick(req, img) {
function enqueueImageVariationTask(req, img, reqDiff) { function enqueueImageVariationTask(req, img, reqDiff) {
const imageSeed = img.getAttribute('data-seed') const imageSeed = img.getAttribute('data-seed')
reqDiff = Object.assign({}, reqDiff, { const newTaskRequest = modifyCurrentRequest(req, reqDiff, {
num_outputs: 1, // this can be user-configurable in the future num_outputs: 1, // this can be user-configurable in the future
seed: imageSeed seed: imageSeed
}) })
const newTaskRequest = modifyCurrentRequest(req, reqDiff)
newTaskRequest.numOutputsTotal = 1 // this can be user-configurable in the future newTaskRequest.numOutputsTotal = 1 // this can be user-configurable in the future
newTaskRequest.batchCount = 1 newTaskRequest.batchCount = 1