From 9dd6b4c930e95032dfd368f5fc78f8c550405d95 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Fri, 22 Aug 2025 17:13:51 +0800 Subject: [PATCH] improve whisper transcribe apt regex --- koboldcpp.py | 4 ++-- otherarch/whispercpp/whisper.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/koboldcpp.py b/koboldcpp.py index 449d714a9..6754bce3a 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -2743,8 +2743,8 @@ class KcppServerRequestHandler(http.server.SimpleHTTPRequestHandler): if boundary: fparts = body.split(boundary) for fpart in fparts: - detected_upload_filename = re.findall(r'Content-Disposition.*name="file"; filename="(.*)"', fpart.decode('utf-8',errors='ignore')) - detected_upload_filename_comfy = re.findall(r'Content-Disposition.*name="image"; filename="(.*)"', fpart.decode('utf-8',errors='ignore')) + detected_upload_filename = re.findall(r'Content-Disposition[^;]*;\s*name=(?:"file"|file)\s*;\s*filename="([^"]+)"', fpart.decode('utf-8',errors='ignore'),flags=re.IGNORECASE) + detected_upload_filename_comfy = re.findall(r'Content-Disposition[^;]*;\s*name=(?:"image"|image)\s*;\s*filename="([^"]+)""', fpart.decode('utf-8',errors='ignore'),flags=re.IGNORECASE) if detected_upload_filename and len(detected_upload_filename)>0: utfprint(f"Detected uploaded file: {detected_upload_filename[0]}") file_content_start = fpart.find(b'\r\n\r\n') + 4 # Position after headers diff --git a/otherarch/whispercpp/whisper.cpp b/otherarch/whispercpp/whisper.cpp index e124441a4..797b21db1 100644 --- a/otherarch/whispercpp/whisper.cpp +++ b/otherarch/whispercpp/whisper.cpp @@ -3490,7 +3490,7 @@ struct whisper_context_params whisper_context_default_params() { } struct whisper_context * whisper_init_from_file_with_params_no_state(const char * path_model, struct whisper_context_params params) { - WHISPER_LOG_INFO("%s: loading model from '%s'\n", __func__, path_model); + WHISPER_LOG_INFO("\n%s: loading model from '%s'\n", __func__, path_model); #ifdef _MSC_VER // Convert UTF-8 path to wide string (UTF-16) for Windows, resolving character encoding issues. std::wstring_convert> converter;