|
@@ -39,6 +39,10 @@
|
|
#include "httplib.h"
|
|
#include "httplib.h"
|
|
#include "json.hpp"
|
|
#include "json.hpp"
|
|
|
|
|
|
|
|
+#if defined(_WIN32)
|
|
|
|
+#include <windows.h>
|
|
|
|
+#endif
|
|
|
|
+
|
|
#include <cstddef>
|
|
#include <cstddef>
|
|
#include <thread>
|
|
#include <thread>
|
|
#include <chrono>
|
|
#include <chrono>
|
|
@@ -2770,8 +2774,28 @@ inline void signal_handler(int signal) {
|
|
shutdown_handler(signal);
|
|
shutdown_handler(signal);
|
|
}
|
|
}
|
|
|
|
|
|
-int main(int argc, char **argv)
|
|
|
|
-{
|
|
|
|
|
|
+#if defined(_WIN32)
|
|
|
|
+char* wchar_to_char(const wchar_t* wstr) {
|
|
|
|
+ if (wstr == nullptr) return nullptr;
|
|
|
|
+
|
|
|
|
+ // Determine the number of bytes needed for the UTF-8 string
|
|
|
|
+ int bytes = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, nullptr, 0, nullptr, nullptr);
|
|
|
|
+ char* str = new char[bytes];
|
|
|
|
+
|
|
|
|
+ // Convert the wide-character string to a UTF-8 string
|
|
|
|
+ WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, bytes, nullptr, nullptr);
|
|
|
|
+ return str;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int wmain(int argc, wchar_t **wargv) {
|
|
|
|
+ char** argv = new char*[argc];
|
|
|
|
+ for (int i = 0; i < argc; ++i) {
|
|
|
|
+ argv[i] = wchar_to_char(wargv[i]);
|
|
|
|
+ }
|
|
|
|
+#else
|
|
|
|
+int main(int argc, char **argv) {
|
|
|
|
+#endif
|
|
|
|
+
|
|
#if SERVER_VERBOSE != 1
|
|
#if SERVER_VERBOSE != 1
|
|
log_disable();
|
|
log_disable();
|
|
#endif
|
|
#endif
|
|
@@ -3282,6 +3306,11 @@ int main(int argc, char **argv)
|
|
return (ctrl_type == CTRL_C_EVENT) ? (signal_handler(SIGINT), true) : false;
|
|
return (ctrl_type == CTRL_C_EVENT) ? (signal_handler(SIGINT), true) : false;
|
|
};
|
|
};
|
|
SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(console_ctrl_handler), true);
|
|
SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(console_ctrl_handler), true);
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < argc; ++i) {
|
|
|
|
+ delete[] argv[i];
|
|
|
|
+ }
|
|
|
|
+ delete[] argv;
|
|
#endif
|
|
#endif
|
|
llama.queue_tasks.start_loop();
|
|
llama.queue_tasks.start_loop();
|
|
svr.stop();
|
|
svr.stop();
|