From ea22e04320bddad836319c490bc8d26f4e3c396c Mon Sep 17 00:00:00 2001 From: LostRuins Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sat, 15 Nov 2025 09:48:22 +0800 Subject: [PATCH] filename insenstive search for adapters --- koboldcpp.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/koboldcpp.py b/koboldcpp.py index 8d6218396..274d28e0e 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -7394,16 +7394,20 @@ def kcpp_main_process(launch_args, g_memory=None, gui_launcher=False): if isinstance(args.chatcompletionsadapter, str) and os.path.exists(args.chatcompletionsadapter): ccadapter_path = os.path.abspath(args.chatcompletionsadapter) elif isinstance(args.chatcompletionsadapter, str) and adapt_dir: - filename = args.chatcompletionsadapter - if filename.lower().strip()=="autoguess": - filename = "AutoGuess" + filename = args.chatcompletionsadapter if not filename.endswith(".json"): filename += ".json" #strip to just the filename filename = os.path.basename(filename) - premade_adapt_path = os.path.join(adapt_dir,filename) - if premade_adapt_path and os.path.exists(premade_adapt_path): - ccadapter_path = os.path.abspath(premade_adapt_path) + # Case-insensitive match inside adapt_dir + matched = None + if adapt_dir: + for f in os.listdir(adapt_dir): + if f.lower().strip() == filename.lower().strip(): + matched = os.path.join(adapt_dir, f) + break + if matched and os.path.exists(matched): + ccadapter_path = os.path.abspath(matched) if ccadapter_path: print(f"Loading Chat Completions Adapter: {ccadapter_path}") with open(ccadapter_path, 'r', encoding='utf-8', errors='replace') as f: