Add local spoken passages with Google retrieval and isolated runtime setup
This commit is contained in:
1 parent
bc9459785d
commit
dab703413e
55 files changed
+3633
-70
No files matched your search
@@ -0,0 +1,42 @@
|
||||
--- a/src/whisper.cpp
|
||||
+++ b/src/whisper.cpp
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
+#include <filesystem>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <random>
|
||||
@@ -3730,13 +3731,7 @@
|
||||
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);
|
||||
-#ifdef _MSC_VER
|
||||
- // Convert UTF-8 path to wide string (UTF-16) for Windows, resolving character encoding issues.
|
||||
- std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
||||
- std::wstring path_model_wide = converter.from_bytes(path_model);
|
||||
- auto fin = std::ifstream(path_model_wide, std::ios::binary);
|
||||
-#else
|
||||
- auto fin = std::ifstream(path_model, std::ios::binary);
|
||||
-#endif
|
||||
+ // C++17 u8path preserves supplementary Unicode on Windows and UTF-8 elsewhere.
|
||||
+ auto fin = std::ifstream(std::filesystem::u8path(path_model), std::ios::binary);
|
||||
if (!fin) {
|
||||
WHISPER_LOG_ERROR("%s: failed to open '%s'\n", __func__, path_model);
|
||||
return nullptr;
|
||||
@@ -4877,13 +4871,8 @@
|
||||
const char * path_model,
|
||||
struct whisper_vad_context_params params) {
|
||||
WHISPER_LOG_INFO("%s: loading VAD model from '%s'\n", __func__, path_model);
|
||||
-#ifdef _MSC_VER
|
||||
- std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
||||
- std::wstring path_model_wide = converter.from_bytes(path_model);
|
||||
- auto fin = std::ifstream(path_model_wide, std::ios::binary);
|
||||
-#else
|
||||
- auto fin = std::ifstream(path_model, std::ios::binary);
|
||||
-#endif
|
||||
+ // Same strict UTF-8 path contract as the base recognizer.
|
||||
+ auto fin = std::ifstream(std::filesystem::u8path(path_model), std::ios::binary);
|
||||
if (!fin) {
|
||||
WHISPER_LOG_ERROR("%s: failed to open VAD model '%s'\n", __func__, path_model);
|
||||
return nullptr;
|
||||
Reference in new issue
Block a user