Skip to content

Commit 6a6e9de

Browse files
author
prima
committed
feat: Autogenerate config for admindir if the folder doesn't contain config or template files
1 parent 1342bf4 commit 6a6e9de

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

koboldcpp.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7360,6 +7360,15 @@ def main(launch_args, default_args):
73607360
args.admin = False
73617361
print("\nWARNING: Admin was set without selecting an admin directory. Admin cannot be used.\n")
73627362

7363+
# Check if admin exists, if not add a default to the directory to allow remote model loading without a config
7364+
if args.admin and args.admindir:
7365+
dirpath = os.path.abspath(args.admindir)
7366+
opts = [f for f in sorted(os.listdir(dirpath)) if (f.endswith(".kcpps") or f.endswith(".kcppt")) and os.path.isfile(os.path.join(dirpath, f))]
7367+
if len(opts) == 0:
7368+
with open(os.path.join(dirpath, "Default.kcpps"), "w") as f:
7369+
f.write("{}")
7370+
print("\nAdmin directory was empty, default file generated.\n")
7371+
73637372
if not args.admin: #run in single process mode
73647373
if args.remotetunnel and not args.prompt and not args.benchmark and not args.cli:
73657374
setuptunnel(global_memory, True if args.sdmodel else False)

0 commit comments

Comments
 (0)