diff --git a/koboldcpp.py b/koboldcpp.py index 1942eae12..1733bda33 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -2761,11 +2761,12 @@ Enter Prompt:
body = None if contlenstr: content_length = int(contlenstr) - if content_length > (1024*1024*48): #48mb payload limit + max_pl = int(args.maxrequestsize) if args.maxrequestsize else 32 + if content_length > (1024*1024*max_pl): #payload size limit self.send_response(500) self.end_headers(content_type='application/json') self.wfile.write(json.dumps({"detail": { - "msg": "Payload is too big. Max payload size is 48MB.", + "msg": f"Payload is too big. Max payload size is {max_pl}MB.", "type": "bad_input", }}).encode()) return @@ -3636,6 +3637,7 @@ def show_gui(): ssl_cert_var = ctk.StringVar() ssl_key_var = ctk.StringVar() password_var = ctk.StringVar() + maxrequestsize_var = ctk.StringVar(value=str(32)) sd_model_var = ctk.StringVar() sd_lora_var = ctk.StringVar() @@ -4177,6 +4179,9 @@ def show_gui(): makefileentry(network_tab, "SSL Key:", "Select SSL key.pem file", ssl_key_var, 9, width=200, filetypes=[("Unencrypted Key PEM", "*.pem")], singlerow=True, singlecol=False, tooltiptxt="Select your unencrypted .pem SSL key file for https.\nCan be generated with OpenSSL.") makelabelentry(network_tab, "Password: ", password_var, 10, 200,tooltip="Enter a password required to use this instance.\nThis key will be required for all text endpoints.\nImage endpoints are not secured.") + makelabelentry(network_tab, "Max Req. Size (MB):", maxrequestsize_var, row=20, width=50, tooltip="Specify a max request payload size. Any requests to the server larger than this size will be dropped. Do not change if unsure.") + + # Horde Tab horde_tab = tabcontent["Horde Worker"] makelabel(horde_tab, "Horde:", 18,0,"Settings for embedded AI Horde worker").grid(pady=10) @@ -4430,6 +4435,7 @@ def show_gui(): args.multiuser = multiuser_var.get() args.multiplayer = (multiplayer_var.get()==1) args.websearch = (websearch_var.get()==1) + args.maxrequestsize = int(maxrequestsize_var.get()) if maxrequestsize_var.get()!="" else 32 if usehorde_var.get() != 0: args.hordemodelname = horde_name_var.get() @@ -4637,6 +4643,8 @@ def show_gui(): horde_apikey_var.set(dict["hordekey"] if ("hordekey" in dict and dict["hordekey"]) else "") horde_workername_var.set(dict["hordeworkername"] if ("hordeworkername" in dict and dict["hordeworkername"]) else "") usehorde_var.set(1 if ("hordekey" in dict and dict["hordekey"]) else 0) + if "maxrequestsize" in dict and dict["maxrequestsize"]: + maxrequestsize_var.set(dict["maxrequestsize"]) sd_model_var.set(dict["sdmodel"] if ("sdmodel" in dict and dict["sdmodel"]) else "") sd_clamped_var.set(int(dict["sdclamped"]) if ("sdclamped" in dict and dict["sdclamped"]) else 0) @@ -6298,6 +6306,7 @@ if __name__ == '__main__': advparser.add_argument("--moeexperts", metavar=('[num of experts]'), help="How many experts to use for MoE models (default=follow gguf)", type=int, default=-1) advparser.add_argument("--defaultgenamt", help="How many tokens to generate by default, if not specified. Must be smaller than context size. Usually, your frontend GUI will override this.", type=check_range(int,128,2048), default=512) advparser.add_argument("--nobostoken", help="Prevents BOS token from being added at the start of any prompt. Usually NOT recommended for most models.", action='store_true') + advparser.add_argument("--maxrequestsize", metavar=('[size in MB]'), help="Specify a max request payload size. Any requests to the server larger than this size will be dropped. Do not change if unsure.", type=int, default=32) compatgroup2 = parser.add_mutually_exclusive_group() compatgroup2.add_argument("--showgui", help="Always show the GUI instead of launching the model right away when loading settings from a .kcpps file.", action='store_true') compatgroup2.add_argument("--skiplauncher", help="Doesn't display or use the GUI launcher.", action='store_true')