Commit 70a0a117 authored by Vespinian's avatar Vespinian
Browse files

Changed behavior that puts the args from alwayson_script request in the...

Changed behavior that puts the args from alwayson_script request in the script_args, so don't accidently resize the arg list if we get less arg then or default list has
parent 3856ada5
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -272,7 +272,9 @@ class Api:
                    raise HTTPException(status_code=422, detail=f"Cannot have a selectable script in the always on scripts params")
                    raise HTTPException(status_code=422, detail=f"Cannot have a selectable script in the always on scripts params")
                # always on script with no arg should always run so you don't really need to add them to the requests
                # always on script with no arg should always run so you don't really need to add them to the requests
                if "args" in request.alwayson_scripts[alwayson_script_name]:
                if "args" in request.alwayson_scripts[alwayson_script_name]:
                    script_args[alwayson_script.args_from:alwayson_script.args_to] = request.alwayson_scripts[alwayson_script_name]["args"]
                    # min between arg length in scriptrunner and arg length in the request
                    for idx in range(0, min((alwayson_script.args_to - alwayson_script.args_from), len(request.alwayson_scripts[alwayson_script_name]["args"]))):
                        script_args[alwayson_script.args_from + idx] = request.alwayson_scripts[alwayson_script_name]["args"][idx]
        return script_args
        return script_args


    def text2imgapi(self, txt2imgreq: StableDiffusionTxt2ImgProcessingAPI):
    def text2imgapi(self, txt2imgreq: StableDiffusionTxt2ImgProcessingAPI):